stefangabos / Zebra_Image

A single-file lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters
https://stefangabos.github.io/Zebra_Image/Zebra_Image/Zebra_Image.html
Other
137 stars 51 forks source link

Composer package code mismatch even if version is the same as GitHub #29

Closed Deewde closed 1 year ago

Deewde commented 1 year ago

Version 2.8.1 tagged on GitHub, also version 2.8.1 tagged on Packagist, yet the Packagist version suffers from the WEBP animation detection bug:

LINE 1536: case IMAGETYPE_WEBP:

                    // because animated WEBP images are not supported
                    // we need to check if this is such a file
                    // WEBP file header https://developers.google.com/speed/webp/docs/riff_container
                    // solution from by Sven Liivak https://stackoverflow.com/questions/45190469/how-to-identify-whether-webp-image-is-static-or-animated#answer-52333192

                    $fh = fopen($this->source_path, 'rb');

                    // let's see if this is the "Extended" file format
                    fseek($fh, 12);

                    // if this is the extended file format
                    if (fread($fh, 4) === 'VP8X') {

                        // look for the "Animation (A)" bit
LINE 1552:              fseek($fh, 16); <----------------------------------- should be 20, not 16

                        // is this is an animated WEBP?
                        $is_animated = ((ord(fread($fh, 1)) >> 1) & 1);

                    }
stefangabos commented 1 year ago

The bug was still there at the time of 2.8.1. This is the code at the time of release.

That fix was applied by this commit which unfortunately I forgot to release.

Working on it now

stefangabos commented 1 year ago

I did release 2.8.2 - apparently everything was ready, I just forgot to do it. Thanks a lot reporting!

Deewde commented 1 year ago

Perfect. Thank you for creating and maintaining this software!