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

Unable to insert/select uploaded animated webp image #454

Open
vstruhar opened this issue Mar 5, 2024 · 4 comments
Open

Unable to insert/select uploaded animated webp image #454

vstruhar opened this issue Mar 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@vstruhar
Copy link

vstruhar commented Mar 5, 2024

Filament Version

v3.2.35

Plugin Version

v3.5.0

PHP Version

PHP 8.3.3

Problem description

Unable to insert/select image after uploading animated webp images, because the Intervention Image package does not support it and throws an exception on src/Components/Forms/Uploader.php:109.

Intervention does support webp images, but it doesn't support animated webp images.
Both have the same extension, that's why it is used by mistake with Intervention, by passing is_media_resizable check.

Is it possible to upload file and not use Intervention to get dimensions and exif?

Expected behavior

User should be able to insert/select animated webp images.

Steps to reproduce

  1. Select animated webp image
  2. After uploading click Insert button
  3. Exception is thrown

Reproduction repository

No response

Relevant log output

No response

@vstruhar vstruhar added the bug Something isn't working label Mar 5, 2024
@vstruhar vstruhar changed the title Issue inserting/selecting uploaded animated webp image Unable to insert/select uploaded animated webp image Mar 5, 2024
@awcodes
Copy link
Owner

awcodes commented Mar 5, 2024

How would you propose getting those values without intervention?

@awcodes
Copy link
Owner

awcodes commented Mar 5, 2024

I'd prefer to use intervention because it handles the drivers for GD and Imagix. I really have no desire to support those natively. And the glide implementation uses it too. So even if it could be bypassed if you tried to output the media with the glider blade component I would think it would still throw an error.

@vstruhar
Copy link
Author

vstruhar commented Mar 6, 2024

I wouldn't mind if width, height and exif would be null, just add check inis_media_resizable when file has webp extension to also do a check if it is animated, if so then file is not resizable. Not sure if this would be desired since it would be unexpected to sometimes not have these values.

I also found a Wordpress function that can extract width, height and type from animated webp images, but I understand you don't want to go this route.

Another approach could be to enable the developer to manually handle this, something like saveUploadedFileUsing method that Filament has on FileUpload component.

@awcodes
Copy link
Owner

awcodes commented Mar 7, 2024

hmm. yea, but the width and height is important to have so that img tags can have the necessary attributes on them for proper html usage and things like preventing layout shift which can hurt Core Web Vitals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants