Hello,
I'm running into a strange issue with GD. Please review
the script attached bellow. I'm using it to generate thumbnail
icon on a fly. I don't know why it gives different results on
different servers. Php on my development server is 4.0.6
and GD is 1.6.2 or higher with jpg/gif/png enabled. The
script works fine and generates very clear icon picture on
my server. However, on the application server, it works
but generate blur image. Php on that server is 4.3.0 and
GD is 2.0 with jpg/gif/png enabled. How come with higher
version it gives poorer performance? Thanks in advance.
Alex
<?
$picName = $HTTP_GET_VARS['pic'];
$picSize = getimagesize ('../pictures/'.$picName);
$thePic = imagecreatefrom jpeg ('../pictures/'.$picName);
$nHeight = 50;
$ratio = $nHeight / $picSize[1];
$nWidth = round ($ratio * $picSize[0]);
$thm = @imagecreate ($nWidth, $nHeight)
or die ("Cannot Initialize new GD image stream");
/*
$result = imagecopyresamp led ($thm, $thePic, 0, 0, 0, 0,
$nWidth, $nHeight, $picSize[0], $picSize[1]);
*/
/*
on my development server imagecopyresamp led don't work but
imagecopyresize d works fine.
*/
$result = imagecopyresize d ($thm, $thePic, 0, 0, 0, 0,
$nWidth, $nHeight, $picSize[0], $picSize[1]);
header ("Content-type: image/png");
$result = imagepng ($thm);
?>
I'm running into a strange issue with GD. Please review
the script attached bellow. I'm using it to generate thumbnail
icon on a fly. I don't know why it gives different results on
different servers. Php on my development server is 4.0.6
and GD is 1.6.2 or higher with jpg/gif/png enabled. The
script works fine and generates very clear icon picture on
my server. However, on the application server, it works
but generate blur image. Php on that server is 4.3.0 and
GD is 2.0 with jpg/gif/png enabled. How come with higher
version it gives poorer performance? Thanks in advance.
Alex
<?
$picName = $HTTP_GET_VARS['pic'];
$picSize = getimagesize ('../pictures/'.$picName);
$thePic = imagecreatefrom jpeg ('../pictures/'.$picName);
$nHeight = 50;
$ratio = $nHeight / $picSize[1];
$nWidth = round ($ratio * $picSize[0]);
$thm = @imagecreate ($nWidth, $nHeight)
or die ("Cannot Initialize new GD image stream");
/*
$result = imagecopyresamp led ($thm, $thePic, 0, 0, 0, 0,
$nWidth, $nHeight, $picSize[0], $picSize[1]);
*/
/*
on my development server imagecopyresamp led don't work but
imagecopyresize d works fine.
*/
$result = imagecopyresize d ($thm, $thePic, 0, 0, 0, 0,
$nWidth, $nHeight, $picSize[0], $picSize[1]);
header ("Content-type: image/png");
$result = imagepng ($thm);
?>
Comment