note 75551 added to function.imagecopyresampled
| From: | kristijan at leftor dot ba | Date: | Tue, 05 Jun 2007 09:09:38 +0000 |
| Subject: | note 75551 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127216@lists.php.net to get a copy of this message | ||
There is bug in POST from tim at leethost dot com
25-Jan-2007 02:00.
Function work correctly when you making thumb from 0,0 to width/height. But if you want copy resized
picture to other coordinates then you must change code in this:
function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y,
$dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
if (empty($src_image) || empty($dst_image)) { return false; }
if ($quality <= 1)
{
$temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);
imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1,
$src_w, $src_h);
imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);
imagedestroy ($temp);
}
elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) <
$src_h))
{
$tmp_w = $dst_w * $quality;
$tmp_h = $dst_h * $quality;
$temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);
imagecopyresized ($temp, $src_image, 0, 0, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w,
$src_h);
imagecopyresampled ($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);
imagedestroy ($temp);
} else
{
imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h,
$src_w, $src_h);
}
return true;
}
----
Server IP: 69.147.83.197
Probable Submitter: 89.146.142.52
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- https://master.php.net/note/edit/75551
Del: integrated -- https://master.php.net/note/delete/75551/integrated
Del: useless -- https://master.php.net/note/delete/75551/useless
Del: bad code -- https://master.php.net/note/delete/75551/bad+code
Del: spam -- https://master.php.net/note/delete/75551/spam
Del: non-english -- https://master.php.net/note/delete/75551/non-english
Del: in docs -- https://master.php.net/note/delete/75551/in+docs
Del: other reasons-- https://master.php.net/note/delete/75551
Reject -- https://master.php.net/note/reject/75551
Search -- https://master.php.net/manage/user-notes.php