![]() |
Any way to compress images - 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: Any way to compress images (/showthread.php?tid=16130) |
Any way to compress images - El Forum - 02-25-2009 [eluser]gvillavizar[/eluser] Hello, In my site my users are uploading pictures, I can limit the file size they're uploading. Is there any way for me to reduce the file size from 1mb to, say 250kb? Thanks for your help. Any way to compress images - El Forum - 02-25-2009 [eluser]pistolPete[/eluser] You can change the quality setting in the image manipulation class: http://ellislab.com/codeigniter/user-guide/libraries/image_lib.html Any way to compress images - El Forum - 02-25-2009 [eluser]gvillavizar[/eluser] [quote author="pistolPete" date="1235592463"]You can change the quality setting in the image manipulation class: http://ellislab.com/codeigniter/user-guide/libraries/image_lib.html[/quote] Thanks for your reply. That worked like a charm. Another question, can I load the library more than once with different properties in the same controller. Like Code: if($photo1) Any way to compress images - El Forum - 02-25-2009 [eluser]pistolPete[/eluser] Don't load it more than once. Use Code: $this->image_lib->clear(); Quote:The clear function resets all of the values used when processing an image. You will want to call this if you are processing images in a loop. Any way to compress images - El Forum - 02-25-2009 [eluser]gvillavizar[/eluser] [quote author="pistolPete" date="1235596149"]Don't load it more than once. Use Code: $this->image_lib->clear(); Quote:The clear function resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.[/quote] Perfect, thanks a lot for your help! That solved a lot! |