Welcome Guest, Not a member yet? Register   Sign In
Image library (GD) resize problem
#1

[eluser]RaBu[/eluser]
Hi,

I'm trying to re-size a newly uploaded image-file in a controller function, I get no errors and the image get re-sized just fine, but the quality is crap. The image get very dusty and with a low amount of colors (in the blue-, gray-, white-ish scale).


Code:
$imageconfig['image_library'] = 'GD';
$imageconfig['source_image'] = "uploads/".$uploadFiles['0'];
$imageconfig['quality'] = "100%";
$imageconfig['maintain_ratio'] = TRUE;
$imageconfig['width'] = 250;
$imageconfig['height'] = 150;

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

$this->image_lib->resize();

Anyone else have experienced this problem?

Kind regards,
Rasmus
#2

[eluser]RaBu[/eluser]
Here you can see an example of the re-sized files:

http://rabu.dk/temp/example1.jpg
http://rabu.dk/temp/example2.JPG
#3

[eluser]brianw1975[/eluser]
Quote:$imageconfig['quality'] = "100%";

did you try and take out the % from 100%?

in the code there is no percent sign, and since text won't convert to an int very easily it'd get converted to 0 i believe.

Code:
class CI_Image_lib {
    
    var $image_library        = 'gd2';      // Can be:  imagemagick, netpbm, gd, gd2
    var $library_path        = '';
    var $dynamic_output        = FALSE;    // Whether to send to browser or write to disk
    var $source_image        = '';    
    var $new_image            = '';
    var $width            = '';
    var $height            = '';
    var $quality            = '90';
#4

[eluser]RaBu[/eluser]
Yes, I have the exact same problem - even if I completely leave out the "quality" parameter.
#5

[eluser]pistolPete[/eluser]
Are you sure you are using GD instead of GD2 ?
#6

[eluser]RaBu[/eluser]
Of course, my phpinfo() says:
GD Version: bundled (2.0.28 compatible)

So changing to GD2 fixed the problem.

Code:
$imageconfig['image_library'] = 'GD2';

Thanks for the pointer Smile
#7

[eluser]Vijusoft[/eluser]
Thanks a lot,

Same problem in my project get solved.
#8

[eluser]quexal[/eluser]
I had the same exact problem... even after switching to GD2 it was still doing it!

Solved by adding the line to my config:

$config['quality'] = '90';


Hope this helps someone else running in to this problem.
#9

[eluser]devbro[/eluser]
I was there done that. basically forget about GD and GD2 if quality of images are important to you. use imagemagick instead.




Theme © iAndrew 2016 - Forum software by © MyBB