You are here: Re: imagecreatetruecolor sometimes causes forced-download of index.php for some JPEG images « PHP Programming Language « IT news, forums, messages
Re: imagecreatetruecolor sometimes causes forced-download of index.php for some JPEG images

Posted by Andy Hassall on 08/05/06 00:27

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.

>> 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).

--
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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация