GD1 poor image quality

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Moozie
Posts: 164
Joined: Sat 8. Nov 2003, 00:21
Location: Netherlands

GD1 poor image quality

Post by Moozie »

I am testing GD1 now to replace Imagick. We use GD 1.8
It seems to work except the thumbnail quality is very poor. A full color pic is reduced to a 2-color like gif-look or something.

But I can upload an image. It shows in FILE section in the admin.

But when I put a test w/image content in an article and click on create content I get the error:

Code: Select all

Warning: imagejpeg(): Unable to open '/home/httpd/vhosts/mydomain.nl/httpdocs/phpwcms/content/images/1_25_OqohIVu4PF-250x.jpg' for writing in /home/httpd/vhosts/mydomain.nl/httpdocs/phpwcms/include/inc_lib/ext/hft_image/hft_image.php on line 338

--------------------------------------------------------------------------------
Unable to output: /home/httpd/vhosts/mydomain.nl/httpdocs/phpwcms/content/images/1_25_OqohIVu4PF-250x.jpg
file=/home/httpd/vhosts/mydomain.nl/httpdocs/phpwcms/include/inc_lib/ext/hft_image/hft_image.php
--------------------------------------------------------------------------------

Warning: getimagesize(/home/httpd/vhosts/mydomain.nl/httpdocs/phpcms/content/images/1_25_OqohIVu4PF-250x.jpg): failed to open stream: 
No such file or directory in /home/httpd/vhosts/mydomain.nl/httpdocs/phpwcms/include/inc_lib/ext/hft_image/hft_image.php on line 298
Any clue?
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

check that you have write access to content/images

GD1 produces bad quality - that's why I prefer ImageMagick.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Moozie
Posts: 164
Joined: Sat 8. Nov 2003, 00:21
Location: Netherlands

Post by Moozie »

OK this works now... dir was on 777. But now suddenly iot works??

Another question:
Is GD2 a lot better than GD1? Cause quality of GD1 is abolutely not acceptable.
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Yes GD2 is much better. Produces really good results - it does not sharpen an image like ImageMagick but creates top quality JPGs. And it's faster.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Moozie
Posts: 164
Joined: Sat 8. Nov 2003, 00:21
Location: Netherlands

Post by Moozie »

OK we installed GD2 and it's much better.

Is it correct that the rotate thumbnail doesn't work anymore? When clicked it produces a regular thumbnail.

Is that fixable ;-)?
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

At the moment this is not fixable. The function for GD resize I use has no rotation code. Maybe I can add this later but has no priority to me at the moment ;-)

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
vvo
Posts: 50
Joined: Sun 9. Nov 2003, 14:07
Location: Netherlands

Post by vvo »

@Oliver: GD2 rotation is possible.

Below is a piece of code which I took from wnailer.vddh.com:

<?
$source = "007.jpg";

$size = GetImageSize($source);
$tot_x = $size[0];
$tot_y = $size[1];

header ("Content-type: image/jpeg");

$source = ImageCreateFromJpeg($source);

switch ($angle){
case 90: // rotate dimensions 90° CW
$result = ImageCreateTrueColor ($tot_y, $tot_x);
for($src_x = 0; $src_x < $tot_x; $src_x++){ // X loop

for($src_y = 0; $src_y < $tot_y; $src_y++){ // Y loop
$dst_x = $tot_y - ($src_y + 1);
$dst_y = $src_x;
ImageCopy($result, $source, $dst_x, $dst_y, $src_x, $src_y, 1, 1);
}

}
break;
case 180: // rotate dimensions 180° CW
// similar
break;
case 270: // rotate dimensions 270° CW or 90° CCW
// similar
break;
case mirror: // mirror
// similar
break;
case flip: // flip
// similar
break;
default:
}

ImageJPEG($result);
// better quality; mucho larger files:
// ImageJPEG($result, '', 100);
?>

Johan.
User avatar
Oliver Georgi
Site Admin
Posts: 9919
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

Yepp - this will be done later.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply