I’m trying to use the kirby 4 resize on upload with this code in my image blueprint:
create:
width: 2000
height: 2000
But that is interfering with my config which was set to pull exif data after file creation:
'hooks' => [
'file.create:after' => function ($file) {
if ($file->type() == 'image') {
// Get date created from exif data
$camera = $file->exif()->camera()->model();
$iso = $file->exif()->iso();
$aperture = $file->exif()->aperture();
$user = kirby()->user()->username();
$userId = kirby()->user();
$date = date("Y-m-d");
function parseFocalLength($file)
{
$rawfocalLength = $file->exif()->focalLength();
if (is_null($rawfocalLength)) {
return '';
}
[$a, $b] = explode('/', $rawfocalLength);
if ($a && $b && $b !== 0) {
return $a/$b . 'mm';
}
return '';
};
$focalLength = parseFocalLength($file);
$file->update(array(
'camera' => $camera,
'iso' => $iso,
'aperture' => $aperture,
'focalLength' => $focalLength,
'Photographer' => $user,
'User-ID' => $userId,
'Date-uploaded' => $date,
// 'tags' => $keywords
));
}
}
],
Without the blueprint “create” the exif is pulled correctly. Is there a workaround for this or something I’m doing wrong?