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

[eluser]Asinox[/eluser]
Hellooooooooooo, please i dont know if other guy's here have the same problem with "image\s manipulation"...

well example i have the code:

Code:
$config['image_library'] = 'gd2';
$config['source_image']    = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width']     = 400;
$config['height']    = 350;
$config['master_dim'] = 'width';

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

$this->image_lib->resize();

but i have a litter problem, the images is resizing to the WIDTH but the HEIGHT sometime is too big.... the another problem is if the images is too small (lees than 400), the images is resizing to the 400 and loss quality....

There's best way to do that?

Thanks..

sorry with my english
#2

[eluser]NateL[/eluser]
[quote author="Asinox" date="1233796028"] the another problem is if the images is too small (lees than 400), the images is resizing to the 400 and loss quality....[/quote]

Not sure about the first problem,

but for the quoted problem, you need to run an if statement to ensure that if it is less than 400, not to run the resize function:

Code:
$image = $this->upload->data();
if($image['width'] > 400)
{
$this->image_lib->resize();
}
else
{
//don't resize
}
#3

[eluser]NateL[/eluser]
k, as far as your first question, I think I have the same question as well, because I'm doing the same thing as you right now...

I have the following two lines in my script:


$config['maintain_ratio'] = TRUE;
$config['width'] = 75;

I have no height set, yet the height remains the same as it is prior to uploading and creating the thumb, so my 800x600 image resizes to 75x600. It is NOT maintaining the aspect ratio, even tho that option has been set to true!

Is this a bug?
#4

[eluser]cwt137[/eluser]
@NateL - Attached is a patch against the SVN trunk that fixes your problem. Originally, the maintain_ratio configure option only worked if you specified both the width and height of the new image. With this patch, you only have to specify the width or the height and it will use the size_calculator() method inside the image_lib class to figure out the other value. So now your code works as expected. I will put a comment in bug #6685.
#5

[eluser]NateL[/eluser]
:wow:

Works like a charm!! Thanks VERY much!!
#6

[eluser]verisof[/eluser]
Thanks for the patch, works fine and was needed!
#7

[eluser]Asinox[/eluser]
Thanks Smile a lot
#8

[eluser]cwt137[/eluser]
no problem
#9

[eluser]imatt[/eluser]
Hi, your patch saves me a lot of time , thank you so much.
Someone know if this patch will be added in codeigniter futur version ?
I think with this patch, it's the right comportement of a resize ...


Thanks
IMatt
#10

[eluser]Marcelo Kanzaki[/eluser]
how do i install this patch?




Theme © iAndrew 2016 - Forum software by © MyBB