You are here: Re: attach imagejpeg to email « PHP Programming Language « IT news, forums, messages
Re: attach imagejpeg to email

Posted by Bob Bedford on 07/06/05 16:24

"Alvaro G Vicario" <alvaro_QUITAR_REMOVE@telecomputeronline.com> a écrit
dans le message de news: 1eflxxsop2euu$.iy62hb8le9iq.dlg@40tude.net...
> *** Bob Bedford wrote/escribió (Wed, 6 Jul 2005 10:52:50 +0200):
>> $image = "/include/images/model.jpg";
>
> Is the path correct? Do you have a directory called "include" in system's
> root directory?
>
Yes of course is the first thing I checked.

In fact my problem was to create an image temporarly, then apply it to an
other (a mask in fact), then send it as attachment, without the need to save
the generated image in a file: here is the code:

I've been able to do so, but I've an error on the file function (look at the
comment):
$image = "/include/images/model.jpg";
$src = imagecreatefromjpeg($image);
$size = getimagesize($image);
$dst = imagecreatetruecolor($size[0],$size[1]);
imagecopy($dst,$src,0,0,0,0,$size[0],$size[1]); //make a copy of the
original model, the mask !!!
$txt_color = ImageColorAllocate ($dst, 0, 0, 0);
imagestring($dst, 16, 350, 220 ,"CODE: ".$code, $txt_color); //write a code
in a field
imagestring($dst, 20, 350, 300 ,"NAME: ".$RS->name, $txt_color); //write the
name on an other field.
$tempimage = "temp.jpg";
imagejpeg($dst,$tempimage); //create jpeg: mask + text on it.
if (!$mail->AddAttachment($tempimage,"model.jpg")) //attach the image using
phpmailer class.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация