|
Attach image to email makeChart2() |
Posted by Jorge Eduardo Ardila on Sep-24-2014 06:44 |
|
Hi Peter, I want to attach a user generated chart to a script in order to fulfill the flow:
generate chart -> sen it via email to a desired email.
However, I want to allocate the generated image on memory using makeChart2(),
instead of writing the disk using .makeChart2().
How can I catch the object in memory and attach to an email, please keep in mind that
the email is generated by an script which runs right after the image is generated.
Thanks in advance,
Jorge Eduardo. |
Re: Attach image to email makeChart2() |
Posted by Peter Kwan on Sep-25-2014 01:45 |
|
Hi Jorge,
The makeChart2 is always generating the chart image in memory. It does not create any file
on disk at all. (makeChart will create disk images, while makeChart2 creates memory
images.) To create the chart image in memory, use:
$aaa = $c->makeChart2(PNG);
Now the chart image is in memory, referenced by the variable $aaa. You can then send it
out as email. The exact code depends on the email library you are using. For example, if you
are using Mail_Mime, the addAttachment method can be used to attach the image file:
http://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php
Hope this can help.
Regards
Peter Kwan |
|