-

  • (3)
  • (2)
  • (1)
  • (1)
  • (0)

 -

   php

 - e-mail

 

 -

 LiveInternet.ru:
: 20.09.2007
:
:
: 41

:

.


: (1), (1), (0), (3)
(5)

PHP GD 2x

, 16 2008 . 23:33 +
 (php)

:
1. N-.
2. C .
3. ( ), PNG 24bit
4.  2 JPEG: 1. SMALL(100x100) 2. BIG(STANDART SIZE)+LOGO


:
  - ... =) ? ! .

: ( ), - PNG 24bit,  =).


, (NotePad) =\
 =):
$filename = "";
$filename_logo = "";

$filename - , .
$filename_logo -  , .
// header('Content-type: image/jpeg');

, , , . ...
$info_img = getimagesize($filename);

$info_img GetImageSize() [0],[1],[2] ........ 2 [0] [1], [0] - [1] - .
list($width, $height) = $info_img;

, list() $info_img[0] $width, info_img[1] $height.
$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;
}

... (- ), :
$s_width -   (SMALL);
$s_height - (SMALL);
$small_image = imagecreatetruecolor($s_width, $s_height);
$big_image = imagecreatetruecolor($width, $height);

 2 :
$small_image - () 100x100;
$big_image - , ;
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);
}

, , JPG/JPEG,GIF,PNG;
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);

100x100(px)
2
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);

, ($big_image) PNG.
ImageAlphaBlending() ...
$logo_image - ImageCreateFromPNG .
$logo_width $logo_height ImageSX( X - ) ImageSY( Y - ), ...
ImageCopy() , .
imagejpeg($small_image, "picture/small_picture.jpg";, 80);
imagejpeg($big_image, "picture/big_picture.jpg", 80);


... : 1. 100x100 2. .
 "imagejpeg($image, "picture.jpg", 80)":
ImageJpeg() - JPEG/JPG
$image - .
"picture.jpg" - .
80 - JPEG 1 100.
.... =) , , :








 <?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$image0000$s_width$s_height$width$height);
imagecopyresampled($big_image$image0000$width$height$width$height);

//     
imagealphablending($imagetrue); 
$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), 00$logo_width$logo_height); 

//  2 
imagejpeg($small_image"picture/small_picture.jpg"80);
imagejpeg($big_image"picture/big_picture.jpg"80); 
?>

 (500x120, 26Kb)


(0)

PHP

, 13 2007 . 14:17 +
MniD (php) 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]