Welcome Guest, Not a member yet? Register   Sign In
Image resize & crop problem, partially solved but still confusing
#1

[eluser]Unknown[/eluser]
Hi!

When I do a resize & crop into a square, some images in a batch behave oddly: The resulting 100px*100px square is mostly filled with the default black background color, and the actual image is just a tiny box in the top left corner. I managed to find out why it happened (detailed below), but I'm still a bit confused whether the issue is buried somewhere in my own code, or is it a setting I've forgotten, or GD etc. Here's what I'm doing:

1. clear(), do config, init, make a temporary copy of the image using image_lib
2. clear(), do config, init, resize the copy to 100px*XXXpx (or XXXpx*100px, if it's horizontal)
3. clear(), do config, init, crop a 100px*100px image to a new location
4. clear(), delete temp file, done.

The code & config details are basically straight from the CI User Guides.

I tracked the problem to step 1. When I make the temporary copy, image_lib resized the original 2000+ * 2300+ px image down to 400px*678px, which wasn't supposed to happen! All there is in the step 1 config array are the new location, source location and image library definition.

So, does image_lib automatically resize the image if no width & height are set?
If so, why, and where can I turn it off?




Theme © iAndrew 2016 - Forum software by © MyBB