#24120 [NEW]: imagecopyresized / imagecopyresampled result is bad
| From: | mail at martin-schultheiss dot de | Date: | Wed, 11 Jun 2003 08:03:12 +0000 |
| Subject: | #24120 [NEW]: imagecopyresized / imagecopyresampled result is bad | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-41666@lists.php.net to get a copy of this message | ||
From: mail at martin-schultheiss dot de
Operating system: RedHat-Linux 7.3
PHP version: 4.3.2
PHP Bug Type: GD related
Bug description: imagecopyresized / imagecopyresampled result is bad
Hi!
I have upgraded from php 4.1.x to 4.3.2 with the builtin
gd library.
Now the result of the imagecopyresized funtion is very
bad, and the result of the imagecopyresampled function
too.
I don`t know how to describe the error exactly, so please
take a look at http://www.martin-schultheiss.de/test.jpg
and http://www.martin-schultheiss.de/test2.jpg
If I dont resize the image but simply read it with
imagecreatefromjpeg the result is OK.
The code used to create the image is:
$source = imagecreatefromjpeg ($filename);
$x = imagesx($source);
$y = imagesy($source);
$max = max($x, $y);
$format = $y > $x; //Portrait or Landscape
$size = 640;
if ($size != $max) { //Image has to be resized
if ($format) {
$result = imagecreate(($x*$size)/$y,$size);
imagecopyresized($result, $source, 0, 0, 0, 0,
(($x*$size)/$y) - 1, $size - 1, $x - 1, $y - 1);
} else {
$result = imagecreate($size,($y*$size)/$x);
imagecopyresized($result, $source, 0, 0, 0, 0, $size - 1,
(($y*$size)/$x) - 1, $x - 1, $y - 1);
}
imageDestroy($source);
} else {
$result = $source;
}
imagejpeg($result);
imageDestroy($result);
Bye,
Martin
--
Edit bug report at http://bugs.php.net/?id=24120&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24120&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24120&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24120&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24120&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24120&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24120&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24120&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24120&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24120&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24120&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24120&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24120&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24120&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24120&r=gnused