note 62692 added to function.imagecopyresampled
| From: | dmitry at dest dot by | Date: | Tue, 07 Mar 2006 14:03:05 +0000 |
| Subject: | note 62692 added to function.imagecopyresampled | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104991@lists.php.net to get a copy of this message | ||
Simple script on change of width and automatic creation of height, and also creation of the
signature in the right we string to a corner. (Only for Jpg)
function easyResize($img_sourse, $save_to, $quality, $width, $str) {
$size = GetImageSize($img_sourse);
$im_in = ImageCreateFromJPEG($img_sourse);
$new_height = ($width * $size[1]) / $size[0]; // Generate new height for image
$im_out = imagecreatetruecolor($width, $new_height);
ImageCopyResampled($im_out, $im_in, 0, 0, 0, 0, $width, $new_height, $size[0], $size[1]);
#Find X & Y for note
$X_var = ImageSX($im_out);
$X_var = $X_var - 130;
$Y_var = ImageSY($im_out);
$Y_var = $Y_var - 25;
#Color
$white = ImageColorAllocate($im_out, 0, 0, 0);
#Add note(simple: site address)
ImageString($im_out,2,$X_var,$Y_var,$str,$white);
ImageJPEG($im_out, $save_to, $quality); // Create image
ImageDestroy($im_in);
ImageDestroy($im_out);
}
// $str - Inscription on the image;
----
Server IP: 195.54.192.44
Probable Submitter: 213.184.238.58
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php
Edit -- http://master.php.net/note/edit/62692
Del: integrated -- http://master.php.net/note/delete/62692/integrated
Del: useless -- http://master.php.net/note/delete/62692/useless
Del: bad code -- http://master.php.net/note/delete/62692/bad+code
Del: spam -- http://master.php.net/note/delete/62692/spam
Del: non-english -- http://master.php.net/note/delete/62692/non-english
Del: in docs -- http://master.php.net/note/delete/62692/in+docs
Del: other reasons-- http://master.php.net/note/delete/62692
Reject -- http://master.php.net/note/reject/62692
Search -- http://master.php.net/manage/user-notes.php