NYCPHP Meetup

NYPHP.org

[nycphp-talk] Double Loading PHP as image - Firefox or PHP?

Mark Armendariz nyphp at enobrev.com
Wed Nov 30 19:54:15 EST 2005


> > What happens if you remove the Content-Disposition header?

Alright, changing the Content Disposition to 'attachment' (from inline)
helps... When calling directly from FF 1.5 it tries to download, only
writing to the output file once.  Calling from an image tag from any browser
seems to work normally (writing once).

> I do something similar and have not noticed a problem. You 
> may want to try passthru instead of readfile.

Is there a means of outputting an image with passthru without using
imagemagick or pnm?  I have Imagemagick on this server, but no pnm.  I'd
rather not need either if possible.

Thanks for your time, guys.

Mark

> -----Original Message-----
> From: talk-bounces at lists.nyphp.org 
> [mailto:talk-bounces at lists.nyphp.org] On Behalf Of Mark Armendariz
> Sent: Wednesday, November 30, 2005 4:37 PM
> To: 'NYPHP Talk'
> Subject: Re: [nycphp-talk] Double Loading PHP as image - 
> Firefox or PHP?
> 
> > Whoa. So let me get this straight... if it's a regular 
> image, FF only 
> > hits once. But if it's your script, then FF hits twice?
> 
> I'm not sure about calling a plain image.  I'll have to check 
> my logs...
> 
> 
> > What happens if you remove the Content-Disposition header?
> 
> Same. Same.
> ----------
> 11/30/2005 16:28:07: Mozilla/5.0 (Windows; U; Windows NT 5.1; 
> en-US; rv:1.8)
> Gecko/20051111 Firefox/1.5
> 11/30/2005 16:28:08: Mozilla/5.0 (Windows; U; Windows NT 5.1; 
> en-US; rv:1.8)
> Gecko/20051111 Firefox/1.5 
> 
> 
> Adding caching headers (even a day ahead) didn't work either. 
>  Well, not directly. When called from an img tag, the caching 
> headers take care of business.  Here's what I used:
> 
> header('Expires: ' . gmdate("D, d M Y H:i:s", time() + 2) . ' GMT');	
> header('Cache-Control: max-age=2, must-revalidate');	
> 
> I'm completely confused as to why it double-loads on a direct 
> call.  I suppose I can keep the caching as my workaround, 
> since the plan is to always call through an image tag.  But I 
> really wish I understood why...
> Whhhyyyyy!!!!!
> 
> Mark
> 
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
> 
> 




More information about the talk mailing list