Added to Wiki: image resizing and squaring 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: Added to Wiki: image resizing and squaring library (/showthread.php?tid=25284) Pages:
1
2
|
Added to Wiki: image resizing and squaring library - El Forum - 12-07-2009 [eluser]JoostV[/eluser] Image resizing and cropping can take up a lot of repetitive code. I added an image library to the Wiki that I use to create thumbs and resized versions of images (square or not). EDIT: This library has been moved to Github https://github.com/accent-interactive/ci-lib-images By default, images are squared from the center, but this can be offset, too. Example usage: Code: function image () Added to Wiki: image resizing and squaring library - El Forum - 02-03-2010 [eluser]JoostV[/eluser] Deadly pointed out the lib threw an error. I had left some old code in there by accident. It has been fixed. Thanks, Deadly! Added to Wiki: image resizing and squaring library - El Forum - 02-04-2010 [eluser]gh0st[/eluser] By square thumbnails and square images; do you mean a similar functionality that Facebook does to its images? Added to Wiki: image resizing and squaring library - El Forum - 02-04-2010 [eluser]JoostV[/eluser] I don't know how Facebook handles images. But squaring here creates a square image, measured from the center of the picture. So, if an image is 200px wide and 100px high, squaring will chip 50 pixels off the left an 50 pixels off the right. Works for portrait images, too, of course Square thumbnails squares the image first, and then resizes it to the size you specify. Say you wish to save three sizes, a thumbnail and a square thumbnail; easy as: Code: // Example of resizing and squaring five images in one go, using 'images' library Added to Wiki: image resizing and squaring library - El Forum - 06-07-2010 [eluser]packetfox[/eluser] Hello there, this seems to be almost exactly what i am looking for for a project i am working on; but i simply cannot figure out how to create squared thumbnails at 160x160px, not matter the size or dimensions of the source file. Is there a way i can facilitate this with your Library? Best regards, D Added to Wiki: image resizing and squaring library - El Forum - 06-07-2010 [eluser]JoostV[/eluser] Code: $sourceimagepath = '/path/to/image/folder/'; Added to Wiki: image resizing and squaring library - El Forum - 06-07-2010 [eluser]packetfox[/eluser] Hi there, this is what i have: Code: $this->images->squareThumb($config['source_image'],$config['target_image'], 160); The Image Library is autoloaded. When i upload images with different dimensions i get different results: Source - Result 600x850 - 85x120 788x1812 - 53x120 468x304 - 160x104 What id really like is all Images get a square Thumbnail of 160x160, disregarding their original Dimensions. Best regards, D Added to Wiki: image resizing and squaring library - El Forum - 06-08-2010 [eluser]JoostV[/eluser] Can you post your complete controller code? Added to Wiki: image resizing and squaring library - El Forum - 06-08-2010 [eluser]packetfox[/eluser] Hello there, i went trough the whole thing before posting it to clean it out a little, and now it appears to work. :-S Thanks for helping out! Best regards, D Added to Wiki: image resizing and squaring library - El Forum - 06-08-2010 [eluser]JoostV[/eluser] You're welcome |