note 29730 added to function.imagecreate
| From: | php dot safras at mycities dot net | Date: | Sun, 23 Feb 2003 14:20:25 +0000 |
| Subject: | note 29730 added to function.imagecreate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44385@lists.php.net to get a copy of this message | ||
This is a function i made to creat Thumbnails using
imagecreatefromjpeg()
imagecreate()
imagecopyresized()
If this is complecated you may send email to php.safras@mycities.net
-----------------------------------------
function SafComMakeThumbnails($filename, $filetype, $filepaths, $filepatht, $filewidth, $filehight,
$smallstart) {
$filename = $filename; // file name on source path
$filetype = $filetype; // file type (gif or jpg in mime format like image/gif or image/pjpeg)
$filepaths = $filepaths; //source :: /usr/home/www/images/visitorcards
$filepatht = $filepatht; //target :: /usr/home/www/images/visitorcards
$filewidth = $filewidth; // resize image width
$filehight = $filehight; // resize image hight
$smallstart = $smallstart; // Small Image start with
if ($filetype =="image/pjpeg") {
$src_img = imagecreatefromjpeg($filepaths . "/" .$filename);
$dst_img = imagecreate($filewidth,$filewidth);
imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $filewidth, $filewidth, imagesx($src_img),
imagesy($src_img));
imagejpeg($dst_img, "$filepatht/$smallstart$filename");
}else{
$src_img = imagecreatefrompng($filepaths."/".$filename);
$dst_img = imagecreate($filewidth,$filewidth);
imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $filewidth, $filewidth, imagesx($src_img),
imagesy($src_img));
imagepng($dst_img, "$filepatht/$smallstart$filename");
}
}
-------------------------------------------
--
http://www.php.net/manual/en/function.imagecreate.php
http://master.php.net/manage/user-notes.php?action=edit+29730
http://master.php.net/manage/user-notes.php?action=delete+29730
http://master.php.net/manage/user-notes.php?action=reject+29730