khashnan / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Auto image format conversion #172

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I think it would be cool if timthumb had the option to automatically convert 
.pngs to .jpg to deal with the occasional huge .png that would be better off 
served as a .jpg

...something like this: 

if (image_size > XXXkb) { convert to jpeg }

if (new_file_size > old_file_size) { abort! } else { make it happen }

It looks like in the past jpegs were being auto-converted to pngs with timthumb 
so the capability seems to be in there somewhere. 

Is this practical with timthumb? 

Can you point me in the right direction?

Thanks!

Original issue reported on code.google.com by JaredVo...@gmail.com on 11 Mar 2011 at 9:48

GoogleCodeExporter commented 8 years ago
Hi Jared - Potentially something like this could be done however there's a 
reason it isn't. The reason being that pngs can have transparency. If the image 
is transparent then saving as a jpg will remove that, making it look less good.

Original comment by BinaryMoon on 14 Mar 2011 at 12:10

GoogleCodeExporter commented 8 years ago
Thanks for getting back to me so quickly. 

Good point! In my case transparency isn't an issue (photos saved as .png) and 
setting a high image size limit would weed out any "legit" pngs (since they 
tend to be under say 200k)

If there an argument or function I can use in timthumb to convert formats?

Original comment by JaredVo...@gmail.com on 14 Mar 2011 at 4:25

GoogleCodeExporter commented 8 years ago
I made an alteration to phpthumb enabling me to use j=1 if i wanted it as a 
jpeg instead. I would refer to it as a hack for now as it is served as a png 
but encoded as a much smaller jpeg. But it works for the time being (for me). 
Is it allowed to attach the modified file here? 

Original comment by torne...@gmail.com on 18 May 2011 at 1:00

Attachments:

GoogleCodeExporter commented 8 years ago
This would be a great feature addition!

Original comment by i...@mindsharestudios.com on 9 Mar 2012 at 5:44