Re: Serving an image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/10/15 viper <recursivepointer@xxxxxxxxx>:
> On Mon, Oct 15, 2012 at 5:48 PM, Rick Dwyer <rpdwyer@xxxxxxxxxxxxx> 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"; />
>

What is the diference between using imagecreatefrompng() and readfile()?
Any performance improvement?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux