mosbth / cimage

Server-side image resizing and cropping on the fly with caching of generated image-files using PHP.
http://cimage.se/
MIT License
267 stars 43 forks source link

Progressive JPG Rendering #177

Open marcus-at-localhost opened 5 years ago

marcus-at-localhost commented 5 years ago

would it be possible to render JPGs progressively?

https://stackoverflow.com/questions/41732652/convert-jpeg-to-a-progressive-jpeg-in-php

mosbth commented 5 years ago

I havent tried it, but should be possible by adding a row

imageinterlace($this->image, true);

above https://github.com/mosbth/cimage/blob/master/CImage.php#L2442

Thats a way to trie it out.

To actually implement it one should add some setting to the config file for default behavior and make it possible to override through the querystring like &interlace=true and &interlace=false.

yogeshsaroya commented 4 years ago

I havent tried it, but should be possible by adding a row

imageinterlace($this->image, true);

above https://github.com/mosbth/cimage/blob/master/CImage.php#L2442

Thats a way to trie it out.

To actually implement it one should add some setting to the config file for default behavior and make it possible to override through the querystring like &interlace=true and &interlace=false.

Good. it's working.

mosbth commented 4 years ago

Implemented in v0.8.0.

1) Configuration file option to set default behaviour for all jpeg files:

    /**
     * Default options using interlaced progressive JPEG images. Set to true to
     * always render jpeg images as interlaced. This setting can be overridden
     * by using `?interlace=true` or `?interlace=false`.
     *
     * Default values are:
     *  interlace:  false
     */
     /*'interlace' => false,*/

2) Use option &interlace in query string to render image as interlaced, will override configuration file setting.

3) Override settings from configuration file using query string with value, as &interlace=true or &interlace=false.