How do you scale/fit an image? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: How do you scale/fit an image? (/showthread.php?tid=62234) |
How do you scale/fit an image? - rakibtg - 06-22-2015 CI3 Image Manipulation library can resize() or crop() image, but it would be great if it had a method to scale an image like scale()! I need to scale an image, for example what ever the image size is i would like to resize it to 200x200. To achieve that i have this code, but it still doesn't resize all the images in 200x200 size again i want to scale the image! PHP Code: $img_properties = [ What would be the idea in this case? Thanks and wish you a great day RE: How do you scale/fit an image? - CroNiX - 06-22-2015 create_thumb is probably what you want then RE: How do you scale/fit an image? - rakibtg - 06-22-2015 (06-22-2015, 03:00 PM)CroNiX Wrote: create_thumb is probably what you want then Thanks, but enabling ''create_thumb' => true'' didn't scale the image :/ it generates a 146x200 image., any other idea? RE: How do you scale/fit an image? - CroNiX - 06-22-2015 It seems it did scale it according to your settings? if you want it 200x200 then turn off maintain_ratio but it will then probably distort/stretch the image. If you want 200x200 with NO distortion than I don't think the image library can do that on its own. You'd need one step more and take the 146x200, create a new blank 200x200 image and center the 146x200 within that and save it. Why does it have to be exactly 200x200? Can't you just create a 200x200px div and center the image in that? Basically same end result but don't need to process the image further. RE: How do you scale/fit an image? - ivantcholakov - 06-22-2015 http://kennykee.com/138/codeigniter-resize-and-crop-image-to-fit-container-div-example/ http://jenssegers.be/blog/31/codeigniter-resizing-and-cropping-images-on-the-fly https://github.com/jenssegers/codeigniter-advanced-images RE: How do you scale/fit an image? - ivantcholakov - 06-22-2015 For more complex manipulations: https://github.com/npetrovski/php5-image https://packagist.org/packages/npetrovski/php5-image |