Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ashley Sheridan
On Tue, 2009-08-11 at 11:54 -0700, Ben Dunlap wrote:
> On Tue, Aug 11, 2009 at 11:52 AM, Ben Dunlap
>  wrote:
> 
> @Adam
> 
> The headers_sent() wasa  test to ensure that no other
> data was creeping
> into the headers before I wanted it to. Keeping it in
> does no harm, as
> it is basically saying, if there are no headers that
> have been sent,
> send the correct ones for the image.
> 
> But if there are headers that have been sent, it sounds like
> they would not have been the correct ones. Which I think would
> cause exactly the problem you're describing.
> 
> Ben
> 
> 
> Oops, looked back at your earlier post and it sounds like you only
> send the image inside the "if(!headers_sent())" block. Never mind, pls
> disregard my earlier noise.
> 
> Ben

Well, this will teach me to pay more attention. Turns out, I was
attempting to output the image before the headers! It was a red herring
that the image was displaying correctly when  the drawing commands were
all inside of the image area. It's probably more of a feature of Fx to
try and recognise the content it's been sent if it can?


Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ben Dunlap
On Tue, Aug 11, 2009 at 11:52 AM, Ben Dunlap wrote:

>
> @Adam
>> The headers_sent() wasa  test to ensure that no other data was creeping
>> into the headers before I wanted it to. Keeping it in does no harm, as
>> it is basically saying, if there are no headers that have been sent,
>> send the correct ones for the image.
>
>
> But if there are headers that have been sent, it sounds like they would not
> have been the correct ones. Which I think would cause exactly the problem
> you're describing.
>
> Ben
>
> Oops, looked back at your earlier post and it sounds like you only send the
image inside the "if(!headers_sent())" block. Never mind, pls disregard my
earlier noise.

Ben


Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ben Dunlap
> @Adam
> The headers_sent() wasa  test to ensure that no other data was creeping
> into the headers before I wanted it to. Keeping it in does no harm, as
> it is basically saying, if there are no headers that have been sent,
> send the correct ones for the image.


But if there are headers that have been sent, it sounds like they would not
have been the correct ones. Which I think would cause exactly the problem
you're describing.

Ben


Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ashley Sheridan
On Tue, 2009-08-11 at 13:29 -0500, Adam Shannon wrote:
> On Tue, Aug 11, 2009 at 1:08 PM, Ashley Sheridan
> wrote:
> 
> > On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote:
> > > I've got a bit of a weird one here. I'm using PHP to output an image.
> > > This works fine when I output as a file, but when I try to feed it
> > > directly to the browser it fills the screen with random characters.
> > >
> > > I know I've got the headers right, as it works some of the time. The
> > > only thing I can spot when it does fail is that some of the image
> > > drawing commands are essentially drawing off the edge of the image area.
> > > I've checked the error logs, and the only errors/notices I can find
> > > today are a bug in phpMyAdmin and a missing favicon file, nothing to do
> > > with this script.
> > >
> > > Has anybody ever noticed a similar problem?
> > >
> > > Thanks,
> > > Ash
> > > http://www.ashleysheridan.co.uk
> > >
> > >
> > Oh. I should note that there has been no headers sent already, as I put
> > the image output part inside of a if(!headers_sent()) block. The headers
> > I'm using for the PNG image are:
> >
> > header("Content-Type: image/png");
> > header("Pragma: no-cache");
> > header("Expires: 0");
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Take the if (!headers_sent()) out and always send the headers.
> 
@Adam
The headers_sent() wasa  test to ensure that no other data was creeping
into the headers before I wanted it to. Keeping it in does no harm, as
it is basically saying, if there are no headers that have been sent,
send the correct ones for the image.

@Martin
The image is being produced by PHP. The command I'm using to output the
image is image_png(), and my OS is correctly reporting a PNG image
(Linux will use the extension as a hint, but gets the filetype from the
contents). Also, for further clarification, the junk output I'm getting
has the letters PNG in the first few characters, so I'm pretty sure this
is a PNG image yes!

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Adam Shannon
On Tue, Aug 11, 2009 at 1:08 PM, Ashley Sheridan
wrote:

> On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote:
> > I've got a bit of a weird one here. I'm using PHP to output an image.
> > This works fine when I output as a file, but when I try to feed it
> > directly to the browser it fills the screen with random characters.
> >
> > I know I've got the headers right, as it works some of the time. The
> > only thing I can spot when it does fail is that some of the image
> > drawing commands are essentially drawing off the edge of the image area.
> > I've checked the error logs, and the only errors/notices I can find
> > today are a bug in phpMyAdmin and a missing favicon file, nothing to do
> > with this script.
> >
> > Has anybody ever noticed a similar problem?
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> Oh. I should note that there has been no headers sent already, as I put
> the image output part inside of a if(!headers_sent()) block. The headers
> I'm using for the PNG image are:
>
> header("Content-Type: image/png");
> header("Pragma: no-cache");
> header("Expires: 0");
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Take the if (!headers_sent()) out and always send the headers.

-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ashley Sheridan
On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote:
> I've got a bit of a weird one here. I'm using PHP to output an image.
> This works fine when I output as a file, but when I try to feed it
> directly to the browser it fills the screen with random characters.
> 
> I know I've got the headers right, as it works some of the time. The
> only thing I can spot when it does fail is that some of the image
> drawing commands are essentially drawing off the edge of the image area.
> I've checked the error logs, and the only errors/notices I can find
> today are a bug in phpMyAdmin and a missing favicon file, nothing to do
> with this script.
> 
> Has anybody ever noticed a similar problem?
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
Oh. I should note that there has been no headers sent already, as I put
the image output part inside of a if(!headers_sent()) block. The headers
I'm using for the PNG image are:

header("Content-Type: image/png");
header("Pragma: no-cache");
header("Expires: 0");

Thanks,
Ash
http://www.ashleysheridan.co.uk


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



[PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Ashley Sheridan
I've got a bit of a weird one here. I'm using PHP to output an image.
This works fine when I output as a file, but when I try to feed it
directly to the browser it fills the screen with random characters.

I know I've got the headers right, as it works some of the time. The
only thing I can spot when it does fail is that some of the image
drawing commands are essentially drawing off the edge of the image area.
I've checked the error logs, and the only errors/notices I can find
today are a bug in phpMyAdmin and a missing favicon file, nothing to do
with this script.

Has anybody ever noticed a similar problem?

Thanks,
Ash
http://www.ashleysheridan.co.uk


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