|
Posted by comp.lang.php on 08/07/06 15:01
Andy Hassall wrote:
> On 4 Aug 2006 16:06:19 -0700, "comp.lang.php" <phillip.s.powell@gmail.com>
> wrote:
>
> >Andy Hassall wrote:
> >> On 4 Aug 2006 15:12:05 -0700, "comp.lang.php" <phillip.s.powell@gmail.com>
> >> wrote:
> >>
> >>>> (1) What _is_ output by the script when it fails?
> >>>
> >>>Nothing. You're forced to download index.php
> >>
> >> Then at least _something_ was output. Accept the download - how long is the
> >> file you download? Is it zero-length or not?
> >
> >It's the length of the original index.php that I wrote, script intact.
> >Not very safe.
>
> That's worrying; even in fairly catastrophic failures that's not supposed to
> happen.
I know.. what could be done to prevent that?
>
> >> So you have reproduced the problem on a new minimal script containing only a
> >> call to imagecreatefromjpeg() and nothing else?
> >
> >Yes, and the download is the script I created with
> >imagecreatefromjpeg() as well.
> >
> >> What is memory_limit set to?
> >> What are the properties of the JPEG file?
> >
> >memory_limit set to 8M (8mb)
> >Properites of the JPEG file are pretty standard AFAIK, I'm sending one
> >"good one" and one "bad one" to you
>
> The images you sent appear to confirm that memory limit is at least part of
> the issue; the smaller (good) image is quite small, whereas the larger (bad)
> image is well over the 8M limit when decompressed. I've just tried it on PHP
> 5.1.2 with memory_limit set to 32M, and memory_get_usage() says that the memory
> used immediately after imagecreatefromjpeg() is:
>
> Memory usage: 9490728
>
> This is a bit higher than I'd expect - the image is 1770x1100 so the
> uncompressed image data would be somewhere in the region of 46728000 bytes (24
> bit colour), or 62304000 (24 bit plus transparency/alpha channel).
>
When I unfortunately increased memory (via ini_set()) the problem was
alleviated (although in the long run that's a really bad idea).. is
there a way to detect if the uncompressed image file size is over the
memory limit? When it's compressed you can't apparently tell.
Thanx
> --
> Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
> http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|