Welcome Guest, Not a member yet? Register   Sign In
image resize makes image look bad.
#1

[eluser]Unknown[/eluser]
I'm letting people upload images and want the images to be a certain height/width if they go over a certain size. The problem is once resized, the image looks bad. It looses most of the color and just has a black/white, brown tone to it. Here's the code:


$this->upload->do_upload($image);
$info=$this->upload->data();

$config['image_library'] = 'GD';
$config['source_image'] = $info['full_path'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 214;
$config['quality']="100%";

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

Am I missing something?

Thanks!
#2

[eluser]tmcw[/eluser]
GD has inferior antialiasing compared to GD2 or ImageMagick. Have you tried either of those? I think GD2 is standard since PHP 4.3 or so...
#3

[eluser]Merolen[/eluser]
Changing to GD2 really did the trick. I made a resizing class using only GD once and I used

Code:
$this->modifImage = imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($this->modifImage,$this->origImage,0,0,0,0,$newwidth,$newheight,$oldx,$oldy);

which also works




Theme © iAndrew 2016 - Forum software by © MyBB