contao / core

Contao 3 → see contao/contao for Contao 4
GNU Lesser General Public License v3.0
490 stars 214 forks source link

Optionally get progressive JPGs #6529

Closed jamesdevine closed 10 years ago

jamesdevine commented 10 years ago

Hi,

Currently if you run a progressive JPEG through Image::get() it is not returned as a progressive JPEG.

See http://php.net/manual/en/function.imageinterlace.php

Is there any possibility of incorporating this into Contao's Image class so that we can optionally get progressive images?

I don't think they work as well in older browsers so it wouldn't make sense to return all JPEGs as progressive JPEGs, but at the moment we can't use them at all in Contao sites.

Progressive images are being used more now as sites become responsive and loading times become ever more important, so it would be nice if we could do this in Contao.

aschempp commented 10 years ago

Maybe you can try to work this out and provide a pull request?

jamesdevine commented 10 years ago

Ok, I've created a pull request. This adds an option under settings to turn progressive images on or off, I figured this would be the best way to do it.

Sorry - there's no language files in the PR - not sure how to deal with those in Contao 3.

aschempp commented 10 years ago

I assumed it would be possible to detect if an image is progressive, and then "use it" again? Not sure if we really need a config option, or do you think it would be good (for performance) to automatically use progressive for ALL images?

jamesdevine commented 10 years ago

Well it could potentially have a negative effect on browsers that don't support progressive images - IE8 and down.

For the browsers that don't support loading images progressively the image isn't displayed until it has completely finished downloading. Unlike with normal JPEGs where the image gradually loads in horizontal sections.

This article goes into more detail if you would like to read more: http://calendar.perfplanet.com/2012/progressive-jpegs-a-new-best-practice/

Personally i'd have no problem with all JPEGs being returned as progressive JPEGs as I think the benefits for modern browsers outweigh the negative effects in older browsers.

leofeyer commented 10 years ago

I'm closing the ticket in favor of the pull request (see #6530).