Welcome Guest, Not a member yet? Register   Sign In
Resize function seems to don't work properly
#1

[eluser]Alhazred[/eluser]
I have a form with a file field to upload an image, this image must be resized to fit a space on a page.

The upload works correctly, but the resize does't.

Here is how I do the resize

Code:
$config['image_library']    = 'gd2';
$config['source_image']     = '.'.$this->config->item('upload_image_base').'/'.'logo_'.$id.'.jpg';
$config['height']           = 70;
$config['width']            = 300;
$config['maintain_ratio']   = TRUE;
$config['master_dim']       = 'height';
                
$this->load->library('image_lib', $config);
                
$this->image_lib->resize();

The source image is

[Image: testmdc.jpg]

This is how CodeIgniter resizes it

[Image: logobestshop.jpg]

As you can see it is not correctly resized, the resized image has a black border, what is the problem? How to solve it?
#2

[eluser]Otemu[/eluser]
Hi,

Try set the height to 120 and keep the width as 300, just to see if it re size using a correct ratio.




Theme © iAndrew 2016 - Forum software by © MyBB