How do you scale/fit an image? |
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
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.
For more complex manipulations:
https://github.com/npetrovski/php5-image https://packagist.org/packages/npetrovski/php5-image |
Welcome Guest, Not a member yet? Register Sign In |