Ken, Actually, in Firefox, even when viewing an image, you can always 'View Source'. You'll just see the binary data. In his case, he would have either seen nothing because his script sent nothing, he would have seen a PHP error followed by the binary data for his image, or possibly some other text having nothing to do with a GIF which is what the browser expected. If his browser wouldn't allow 'View Source' on an image, then I also suggested that he change the Content-Type to 'text/plain' so he would see exactly what was coming back. If he just comments out the content-type header line, it would fall back to text/html and he may not see exactly what is being sent back.
The sites I program for use dynamic images for everything so I deal with this problem frequently (More than I would prefer). =) Anyway, I suggest a debugging proxy if you start having issues like this and want to get a better idea of what is on the wire. I use Fiddler on my windows boxes. Lee On 12/26/06, Ken Stanley <[EMAIL PROTECTED]> wrote:
Good day. I've been watching the list for a little while now, but I think now would be a good time to jump in with a suggestion. Don, I am going to assume that you are not viewing a 'typical' web page (one that contains HTML, etc), but instead you are trying to view the script itself that is trying to generate the image. If this is the case, then there is no source to view as aforementioned by Lee. What you can try to do is to turn on E_ALL error reporting, and then comment out the line of code you are using to output the Content-Type for your image. If there are errors, this should allow you to see them, along with the contents of the image itself. When you set an image header, the web browser doesn't treat it like a typical file, therefor in most cases -- at least the ones I've dealt with -- you won't see your PHP errors in the output. I hope this helps. :) On 12/26/06, Don Reeves <[EMAIL PROTECTED]> wrote: > > I have actually tried to 'view source' but the option is not available > when I am viewing this page. > > ----- Original Message ---- > From: Lee Saferite < [EMAIL PROTECTED]> > To: Don Reeves <[EMAIL PROTECTED]>; Zend Framework General <[email protected] > > > Sent: Tuesday, December 26, 2006 8:17:56 AM > Subject: Re: [fw-general] dynamic image generation > > Generally, in firefox, you can 'view source' and get the actual error > message the server sent. > > Send us that error please. > > Lee > > On 12/25/06, Don Reeves <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I am new to the Zend Framework but am very happy with what I have seen > > so far. I have decided to try integrating the framework into an application > > that I wrote previously. Things have been going smoothly except for some > > scripts that I have written to handle dynamically displaying images. These > > images are charts that I use in the application. Here is a script that I > > have converted into a controller in my application. I access it from a url > > in the following manner: > > > > http://localhost/chart/index/dir/dir123/file/chart123.gif > > > > The controller is pretty basic at the moment: > > > > class ChartController extends Zend_Controller_Action > > { > > function indexAction() > > { > > $runDir = $this->_getParam('dir'); > > $file = $this->_getParam('file'); > > > > header("Content-type: image/gif"); > > > > $image = imagecreatefromgif(RUNS_DIR . '/' . $runDir . '/' . > > $file); > > imagegif($image); > > imagedestroy($image); > > } > > } > > > > An almost identical script allowed me to generate the gif images > > previously. I have also confirmed that the image referenced in > > imagecreatefromgif is referencing a valid gif file. > > > > When I access the url http://localhost/chart/index/dir/dir123/file/chart123.gif > > , I get the following message: > > > > "The image " http://localhost/chart/index/dir/dir123/file/chart123.gif > > " cannot be displayed, because it contains errors." > > > > I am curious if there is anything about the Zend Framework that > > prevents this image from displaying correctly. I was wondering if it had to > > do with how I am setting my header but examining the header using Tamper > > Data for Firefox, the headers seem to be getting set correctly. Can anyone > > see a problem with my implementation that needs to change to generate images > > dynamically within the ZF? > > > > Thanks for the help. > > > > D > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam protection around > > http://mail.yahoo.com > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > -- It looked like something resembling white marble, which was probably what it was: something resembling white marble. -- Douglas Adams, "The Hitchhikers Guide to the Galaxy"
