PHP GD 2x |
|
:
1. N-.
2. C .
3. ( ), PNG 24bit
4. 2 JPEG: 1. SMALL(100x100) 2. BIG(STANDART SIZE)+LOGO
: ( ), - PNG 24bit, =).
$filename = ""; $filename_logo = ""; |
// header('Content-type: image/jpeg'); |
$info_img = getimagesize($filename); |
list($width, $height) = $info_img; |
$small_size = 100; |
if($width > $height) { $s_width = $small_size; $s_height = $small_size*($height/$width); } if($width < $height) { $s_width = $small_size*($width/$height); $s_height = $small_size; } if($width == $height) { $s_width = $small_size; $s_height = $small_size; } |
$small_image = imagecreatetruecolor($s_width, $s_height); $big_image = imagecreatetruecolor($width, $height); |
if($info_img['mime'] == 'image/gif') { $image = imagecreatefromgif($filename); } if($info_img['mime'] == 'image/jpeg') { $image = imagecreatefromjpeg($filename); } if($info_img['mime'] == 'image/png') { $image = imagecreatefrompng($filename); } |
imagecopyresampled($small_image, $image, 0, 0, 0, 0, $s_width, $s_height, $width, $height); imagecopyresampled($big_image, $image, 0, 0, 0, 0, $width, $height, $width, $height); |
imagealphablending($image, true); $logo_image = imagecreatefrompng($filename_logo); $logo_width = ImageSX($logo_image); $logo_height = ImageSY($logo_image); imagecopy($big_image, $logo_image, $width-($logo_width+10), $height-($logo_height+10), 0, 0, $logo_width, $logo_height); |
imagejpeg($small_image, "picture/small_picture.jpg";, 80); imagejpeg($big_image, "picture/big_picture.jpg", 80); |
<?php $filename = ""; // $filename_logo = ""; // PNG $small_size = 100; // $info_img = getimagesize($filename); // list($width, $height) = $info_img; // if($width > $height) { $s_width = $small_size; $s_height = $small_size*($height/$width); } if($width < $height) { $s_width = $small_size*($width/$height); $s_height = $small_size; } if($width == $height) { $s_width = $small_size; $s_height = $small_size; } $small_image = imagecreatetruecolor($s_width, $s_height); $big_image = imagecreatetruecolor($width, $height); // if($info_img['mime'] == 'image/gif') { $image = imagecreatefromgif($filename); } if($info_img['mime'] == 'image/jpeg') { $image = imagecreatefromjpeg($filename); } if($info_img['mime'] == 'image/png') { $image = imagecreatefrompng($filename); } imagecopyresampled($small_image, $image, 0, 0, 0, 0, $s_width, $s_height, $width, $height); imagecopyresampled($big_image, $image, 0, 0, 0, 0, $width, $height, $width, $height); // imagealphablending($image, true); $logo_image = imagecreatefrompng($filename_logo); $logo_width = ImageSX($logo_image); $logo_height = ImageSY($logo_image); imagecopy($big_image, $logo_image, $width-($logo_width+10), $height-($logo_height+10), 0, 0, $logo_width, $logo_height); // 2 imagejpeg($small_image, "picture/small_picture.jpg", 80); imagejpeg($big_image, "picture/big_picture.jpg", 80); ?> |
|
PHP |
|
PHP:
$from = "admin"; //
$to = "tiger1989@mail.ru"; //
$filename = "certificates/image.jpg"; //
$subj = 'TIGER IMAGE'; //
$text = 'Hello from tigercms.com'; //
$f = fopen($filename,"rb"); // $filename
$un = strtoupper(uniqid(time()));
$head = "From: $fromn"; //
$head .= "To: $to ";
$head .= "Subject: $subj ";
$head .= "X-Mailer: PHPMail Tool ";
$head .= "Reply-To: $from ";
$head .= "Mime-Version: 1.0 ";
$head .= "Content-Type:multipart/mixed;";
$head .= "boundary="----------".$un."" ";
$zag = "------------".$un." Content-Type:text/html; ";
$zag .= "Content-Transfer-Encoding: 8bit $text ";
$zag .= "------------".$un." ";
$zag .= "Content-Type: application/octet-stream;";
$zag .= "name="".basename($filename)."" ";
$zag .= "Content-Transfer-Encoding:base64 ";
$zag .= "Content-Disposition:attachment;";
$zag .= "filename="".basename($filename)."" ";
$zag .= chunk_split(base64_encode(fread($f,filesize($filename))))." "; //
// base64, "chunk_split"
mail("$to", "$subj", $zag, $head); // mail()
font>
|
: | [1] |