On Mon, Oct 15, 2012 at 5:48 PM, Rick Dwyer <[email protected]> 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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php