Welcome Guest, Not a member yet? Register   Sign In
Problem with image manipulation
#1

[eluser]scherman[/eluser]
Hi codeigniters, first of all, my english doesn't very good, so i hope you can understand me. I have a problem with the image manipulation.
I want to upload an image through my web, and this image will be resized (mantaining the aspect ratio).
I don't care the image's width, but i want to the height equals to 389px, and obviusly, i want to maintain the aspect ratio of the image.
And it doesn't work. The image is uploaded and resized but it doesn't maintain de aspect ratio.

This is my code (only the resize's part):
Code:
$config = array(
'source_image' => $path . $imagen_high //this url its ok,
'maintain_ration' => TRUE,
'height' => 389
);

$this->load->library('image_lib', $config);
$this->image_lib->resize();

So, at this line i set the height:
Code:
'height' => 389

And like i said before, i don't care about the width, i only want that the height will be 389px.

The problem is if i upload an 800x600 for example, the resizer change only the height and it stay 800px height.

image-> 800x600
resize();
image->800x389

So, how can i do for maintain the image's aspect ratio?

Thank you,




Theme © iAndrew 2016 - Forum software by © MyBB