![]() |
Imgresizer library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Imgresizer library (/showthread.php?tid=18449) |
Imgresizer library - El Forum - 05-06-2009 [eluser]Johan André[/eluser] Hey! I just created this little library based on "Smart Image Resizer" by Joe Lencioni (http://shiftingpixel.com). The original code is located here!. It probably need some trimming but it works... Features + Resizes jpg, png & gifs based on width or height (if both set they'll act as max sizes) + Sharpening jpgs (for crispier viewing at any size) + Cropping based on ratios (like 16:9) + Colorfill for transparent gif & pngs + Caches the resized image + Optional outputting of an <img>-tag. Therefore it can be used only for discreet resizing. Requirements: PHP 5.1+ GD2 Usage: In your controller: Code: $this->load->library('imgresizer'); In your view: Code: $this->imgresizer->create(array('filename' => 'myimage.jpg', 'width' => 300)); This will output a version of myimage.jpg which is 300px wide and maintain the aspect ratio. The resized image is saved to cache and fetch from there the next time you view your page. Imgresizer library - El Forum - 05-06-2009 [eluser]xwero[/eluser] can you compare the pro and contra's between your class and CIs img_lib Imgresizer library - El Forum - 05-06-2009 [eluser]Thorpe Obazee[/eluser] Yeah, I'd like to see that since I'm currently working on something for the boss. Imgresizer library - El Forum - 05-06-2009 [eluser]Johan André[/eluser] [quote author="xwero" date="1241673051"]can you compare the pro and contra's between your class and CIs img_lib[/quote] Sure! Standard imagelibrary does not cache, does not sharpen, does not do easy crop. It can't be used in a creative way (like in views) to output images. My lib does not do rotating or watermarking... yet. The main advantage is that I create the sizes of images, do the cropping and output it directly in the view. If I change the layout, let's say I need avatars to be 120x120 instead of 80x80, I just change it in the view. In my system it saved alot of time. Also the sharpening is REALLY cool! ![]() Imgresizer library - El Forum - 05-09-2009 [eluser]dbashyal[/eluser] i want to use it in my codefight cms. i hope you don't mind if i leave the credit on top. Imgresizer library - El Forum - 05-10-2009 [eluser]Johan André[/eluser] [quote author="dbashyal" date="1241884758"]i want to use it in my codefight cms. i hope you don't mind if i leave the credit on top.[/quote] No problem! I won't claim any credit since I only converted it to CI. Cool that u are using it! Joe (the original author) emailed me and said that he is working on v2.0. It's seems really cool, with smart cropping to keep the important details when cropping. Maybe I'll do a conversion of it too... ![]() Take care Johan |