Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avif files do not get cropped or resized #74

Open
trych opened this issue Jun 19, 2023 · 1 comment
Open

avif files do not get cropped or resized #74

trych opened this issue Jun 19, 2023 · 1 comment
Labels

Comments

@trych
Copy link

trych commented Jun 19, 2023

Hi there!

Thanks for the great plugin.

I have some srcset options like this:

  'flokosiol' => [
    'focus' => [
      'srcsets' => [
        'default' => [
          '300w'  => ['width' => 300, 'height' => 200],
          '600w'  => ['width' => 600, 'height' => 400],
          '900w'  => ['width' => 900, 'height' => 600]
        ],
        'avif' => [
          '300w'  => ['width' => 300, 'height' => 200, 'format' => 'avif'],
          '600w'  => ['width' => 600, 'height' => 400, 'format' => 'avif'],
          '900w'  => ['width' => 900, 'height' => 600, 'format' => 'avif']
        ],
        'webp' => [
          '300w'  => ['width' => 300, 'height' => 200, 'format' => 'webp'],
          '600w'  => ['width' => 600, 'height' => 400, 'format' => 'webp'],
          '900w'  => ['width' => 900, 'height' => 600, 'format' => 'webp']
        ],
      ]
    ]
  ]

While this works when I just use the webp options, it does not work when I use the avif options. This works neither for the .webp files nor for the .avif files. (Edit #2: It does work for the .webp files, but only when the thumbs driver is set to gd, if it's set to im no format works, not even regular jpg.) It does create .avif/.webp with file names like image-300x200-crop-50-50.avif but the result is an avif of the original resolution.

Thanks for looking into this!

@trych trych changed the title avif files do not get cropped or resized avif and webp files do not get cropped or resized Jun 19, 2023
@trych trych changed the title avif and webp files do not get cropped or resized avif files do not get cropped or resized Jun 19, 2023
@flokosiol
Copy link
Owner

Thanks for reporting @trych

First of all, AVIF seems not to be supported by the SimpleImage class (GD), which is used by Kirby internally → https://forum.getkirby.com/t/avif-files-not-resized-or-converted-when-using-thumbs/26954/9?u=flokosiol

This said, it should work with IM. Could you please check if the default cropping (without the focus plugin) and the default srcset options do work?

This is really important, because the Focus plugin does not crop by itself, but it modifies the cropping values which are than handled by Kirby. But I do have customize the Darkroom Classes for GD and IM … and maybe there has been an update lately which is not yet integrated in Focus. I haven't made a change in a while. Maybe it's time again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants