CodeIgniter Forums
Convert all uploaded images to JPG? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Convert all uploaded images to JPG? (/showthread.php?tid=4220)



Convert all uploaded images to JPG? - El Forum - 11-13-2007

[eluser]Phil Sturgeon[/eluser]
Could have sworn I posted something on this, but apparently not. I am trying to force all uploaded images to be saved as JPG, but I want them to be able to upload GIF and PNG too. Therefore instead of just limiting what can be uploaded, I need to convert everything to JPG.

I tried extending the Image Manipulation class but it just breaks alot, its too confusing for poor little ill me. Can anyone lemme know how this can be done easily? Plain PHP is fine or a lib extention, whichever!


Convert all uploaded images to JPG? - El Forum - 11-13-2007

[eluser]Michael Wales[/eluser]
Did you try the suggestion we discussed - but in plain PHP (rather than extending).

Use the Mime lib to determine file type, GD2 createfrom* method to create the image, then save as JPED using the GD2 methods?

I know you attempted this by extending the image lib - but give it a shot with straight PHP and see if it pans out.

Weren't you returning blank screens? Syntax error?


Convert all uploaded images to JPG? - El Forum - 03-18-2008

[eluser]funkmyer[/eluser]
If you have imagemagick installed simply add this:

system("convert {$_FILES[0]['tmp_name']} /some/where/mynewimage.jpg");