note 29730 deleted from function.imagecreate by didou
| From: | didou@php.net | Date: | Fri, 20 Jun 2003 12:36:15 +0000 |
| Subject: | note 29730 deleted from function.imagecreate by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-50733@lists.php.net to get a copy of this message | ||
Note Submitter: php.safras@mycities.net
----
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");
}
}
-------------------------------------------