Welcome Guest, Not a member yet? Register   Sign In
Image manipulation - aspect ratio ignored
#1

[eluser]Unknown[/eluser]
I am having difficulty with trying to resize an image and maintain the aspect ration - I am not sure whether it is just something I am doing wrong or whether I am trying to acheive something that CI simply doesn't support.

Code:
$image['image_library'] = 'gd2';
$image['source_image'] = '/path/to/myfile.png';
$image['create_thumb'] = TRUE;
$image['maintain_ratio'] = TRUE;
$image['thumb_marker'] = '_video';
$image['width'] = '134';
$this->load->library('image_lib', $image);
$this->image_lib->resize();

My understanding is that the above code should resize the source image and create a new one with the suffix of _thumb, a width of 134px whilst maintaining the aspect ratio.

What actually happens is an image with a suffix of _thumb, a width of 134px and the height of the original image.

If anyone can point out where my error is, it would be appreciated!




Theme © iAndrew 2016 - Forum software by © MyBB