splittingred / phpThumbOf

A secure phpthumb output filter for MODx Revolution
http://rtfm.modx.com/display/addon/phpthumbof/
23 stars 17 forks source link

If output format is not specified, try to determine format from the original file extension #18

Closed judereid closed 13 years ago

judereid commented 13 years ago

We found when using phpthumbof, if we did not specify the output format it would default to png, which was generating some large image files. For example we had a 100kb jpeg that was coming out as a 1mb png. When I switched the output format to jpeg it became a 26kb file. So I updated the script to attempt to get the extension from the filename and if it matches jpeg,jpg,gif,png,bmp use the respective output format.

I'm unsure if there's a reason behind setting png as the default type, the only thing I could think of was to account for transparent images, so I went with jpeg as the default if the extension cannot be pulled from the filename, or if it does not match jpeg, jpg, gif, png or bmp.

splittingred commented 13 years ago

Thanks guys!