marlokessler / strapi-plugin-image-optimizer

Optimize your images for desktop, tablet and mobile and different image formats.
MIT License
14 stars 10 forks source link

Bug: Incorrect image formats (extension not corresponding to format) #33

Closed Lucurious closed 11 months ago

Lucurious commented 11 months ago

Bug description

When generating images in multiple formats, files are created with the right extensions, but with the wrong format. A .png might have an internal format of AVIF. This also causes some browsers (such as Edge) to fail loading the images. This incorrect behavior can easily be observed by comparing filesizes between the different formats: they are all the same.

How this happens

The issue occurs because the intermediate output images are incorrectly hashed between generation and exporting, causing them to be overridden by the next generation pass.

Fix

Include the output-format in the intermediate filename.