|
Posted by Jerry Stuckle on 11/04/06 16:26
Ryan Knopp wrote:
> Jerry Stuckle wrote:
>
>> Ryan Knopp wrote:
>>
>>> So if I create a gif image using the source below the image won't
>>> display at all in IE. I just get a red X. It displays right with
>>> Firefox and it also displays okay if i open it up in Paint or *name
>>> your image software here*. Why won't it display in IE? Is there
>>> something I need to do special to make it work?
>>>
>>>
>>> #!/usr/bin/php
>>> <?
>>>
>>> $DOTS = 5000;
>>> $WIDTH = 6300;
>>> $HEIGHT = 6300;
>>>
>>> $im = imagecreatetruecolor($WIDTH, $HEIGHT);
>>>
>>> for($i = 0; $i < $DOTS; ++$i){
>>> imagesetpixel($im , rand(1, $WIDTH - 1), rand(1, $HEIGHT - 1),
>>> imagecolorallocate($im, 250, 250, 250));
>>> }
>>>
>>> imagegif($im, "../public_html/map.gif");
>>> imagedestroy($im);
>>>
>>> ?>
>>>
>>>
>>
>> You haven't told the browser what this is. You need to set the
>> content type, i.e.
>>
>> header("Content-Type: image/gif");
>>
>> Also, the shebang is not needed when running under a web browser - and
>> in fact can cause problems (it will get sent to the browser).
>>
>
> I'm writing this gif out to a file where it get access from the browser.
> It's not getting created on the fly during the browser call. Why would
> I need a header? Wouldn't apache or do that for me? If i put a gif or
> any file in a directory i can access it without the header command. Or
> am i wrong?
Ah, I'm sorry - you're correct. I was thinking you were putting it out
here. I should have read more closely.
No, you shouldn't need to add the header. Try clearing your cache in
IE. I've seen that cause similar problems before.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|