473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to email a image in attachment

I create an image on the fly, and want to email it to the receiver.
But I can't. Since the php mail function needs string as message to
send the the message, but I only get my gd resource object, how can I
get the string presentation of the GD resourse.
BTW:I don't want to save it as a file first, then read from file.
Jul 17 '05 #1
4 2834
*** wilson galaxy wrote/escribió (25 Oct 2004 08:46:02 -0700):
I create an image on the fly, and want to email it to the receiver.
But I can't. Since the php mail function needs string as message to
send the the message, but I only get my gd resource object, how can I
get the string presentation of the GD resourse.
BTW:I don't want to save it as a file first, then read from file.


The mail() function is pretty simple. Unless you are willing to write all
code from scratch, you'd better find a class with support from MIME
attachments. Check here:

http://pear.php.net/packages.php?catpid=14&catname=Mail
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Jul 17 '05 #2
Hello,

On 10/25/2004 12:46 PM, wilson galaxy wrote:
I create an image on the fly, and want to email it to the receiver.
But I can't. Since the php mail function needs string as message to
send the the message, but I only get my gd resource object, how can I
get the string presentation of the GD resourse.
BTW:I don't want to save it as a file first, then read from file.


You may want to try this class that lets you compose and send messages
with attached images or even embedded in HTML message body if you would
like that:

http://www.phpclasses.org/mimemessage
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #3
Thanks guy!!
My issue is I don't have a real file of this image, all I have is a gd
resource object, It seems all mail functions require either the file
name, or the string presentation of the image file. And I can not find
a way to get the string presentation of my gd resource. I am in php 4
not php 5 .

Thanks

Jul 17 '05 #4
Hello,

On 10/25/2004 04:38 PM, yi*******@yahoo.com wrote:
Thanks guy!!
My issue is I don't have a real file of this image, all I have is a gd
resource object, It seems all mail functions require either the file
name, or the string presentation of the image file. And I can not find
a way to get the string presentation of my gd resource. I am in php 4
not php 5 .


No, the MIME message can also take data in strings to add as
attachments. The example demonstrates that.

As for capturing the GD output as a string, try using output buffering:

ob_start()
ImageGIF($im);
$image_data=ob_get_contents();

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
3
by: Bob Bedford | last post by:
I'm trying to add an imagejpeg result as an attachment of an email. For creating the email I'm using phpmailer class (http://phpmailer.sourceforge.net/) Now I do create an image from a jpeg file...
4
by: David Ehmer | last post by:
Does anyone know of a form to email ASP script that allows the user to attach an image file from their computer to be sent as an attachment to the email, along with other data collected from the...
49
by: Lauren Wilson | last post by:
Hi folks, Just wondered if, for the sake of clarity, it is permissible to post small image files of an error box along with a text message about a problem with Access?
2
by: Ryan Taylor | last post by:
Hello. I have an ASP.NET application where I allow the user to upload attachments. I upload the attachments as binary data to an image column in sql server. I have managed to upload the data...
8
by: Warren Post | last post by:
At <http://snow.prohosting.com/srcopan/dry/test.es.html>, you will see that the background image runs down the left margin. The right hand side of it is faded, watermark style, but it is one single...
0
by: =?Utf-8?B?Sm9uIEdvbnphbGVz?= | last post by:
I have this email composed using System.Net.SmtpClient. I am successful in attaching image on the email and shows it to the body of the message by using HTML Tag <img src=image.jpg />. But the...
0
by: suresh_nsnguys | last post by:
Hi, i will allow user to enter their email address in my application.i will send some message with jpeg image attachment as mail to their specified email id. If user enter...
0
by: BuntyJ | last post by:
I have made an mail application to send mail. I am using richtextbox ver.5 for the body of mail. Most of the things is going fine, but i am facing one problem as follow: When user open an outlook...
1
by: E11esar | last post by:
Hi there. I am developing a mobile device application which has an OpenFileDialog control which copies an image into a PictureBox, code as follows: try { OpenFileDialog open = new...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.