Re: Serving an image
| From: | viper | Date: | Mon, 15 Oct 2012 15:58:06 +0000 |
| Subject: | Re: Serving an image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319463@lists.php.net to get a copy of this message | ||
On Mon, Oct 15, 2012 at 5:48 PM, Rick Dwyer <rpdwyer@earthlink.net> wrote:
> I am sending an email with a logo at the top of the email. The source of the image for the
> logo is:
>
> http://myurl.com/image.php?id=5
>
> Image.php then calls a function that simply returns the following:
>
>
>
> $image='<img
> src="http://myurl.com/images/logo.jpg" />';
> return $image;
>
>
>
> Calling the page directly via the URL
> http://myurl.com/image.php?id=5 works fine.
> But when the email is opened, I get the broken link/image icon even though I can see in my
> source that the URL which works when loaded into a browser.
>
> What needs to be done to serve that image to a email client when it is opened?
in image.php you should return an image/xxx file and not an HTML tag.
try something like this:
image.php:
$im = imagecreatefrompng("test.png");
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
then in your email you can put:
<img src="http://myurl.com/image.php?id=5" />
--
+ http://vipertechnology.dyndns.org
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
+ http://vipertechnology.dyndns.org/cotnact/