|
Posted by comp.lang.php on 08/04/06 21:44
Actually I was wrong and found out the problem isn't
imagecreatetruecolor() but it happens to be imagecreatefromjpeg(),
again, only with certain JPEG images. There is nothing I could find
that distinguished one JPEG from another; they're all roughly the same
size, compression, having the same permissions, group and onwership,
all the same amount of color, all from the same CD source.
I thought it was exceeding of memory_limit, however, using
memory_get_usage() I am finding the memory allotted for use in the
script is far below memory_limit, however, it still "dies".
Phil
Andy Hassall wrote:
> On 4 Aug 2006 09:22:45 -0700, "comp.lang.php" <phillip.s.powell@gmail.com>
> wrote:
>
> >index.php:
> >
> >[PHP]
> >// STUFF
> > // STEP 1: imagecreatetruecolor ONLY IF GD 2.0+ SUPPORTED AND FOUND
> > if ($this->isSuccessful && !$hasMogrified && $image && !$newImage &&
> >function_exists('imagecreatetruecolor') && preg_match('/2\.0/i',
> >$this->gd_info_array[0])) {
> > $newImage = @imagecreatetruecolor($configArray['width'],
> >$configArray['height']);
> > if (!$newImage) {
> > $this->isSuccessful = false;
> > $this->setErrorArray(array('action' => 'Could not seem to create
> >new image'));
> > }
> > }
> >
> >[/PHP]
> >
> >This block of code will sometimes, for reasons I just don't understand,
> >cause a forced-download of the entire index.php script! This is not
> >even a consistent issue inasmuch as this only happens to certain JPEG
> >images. I am completely unable to discern a pattern; it happens to
> >some JPEG images and not to others; furthermore, this behavior does not
> >occur in GIF or PNG images.
> >
> >I am using PHP 4.3.9 with GD 2.0.1 in Linux RHEL 4.
>
> There was probably an error in the script, so what comes out isn't image data.
> Your first thing to do is check the actual output. Either download the data
> it's offering and look at it with an editor, or temporarily change the
> Content-type.
>
> You also mention that the symptoms occur with specific JPEG images; can you
> find some common factor in these images that is not in the other images?
>
> Given the considerably higher compression ratio in JPEG vs. PNG and GIF -
> since it's lossy it can reduce much further than the other two lossless formats
> - then you have to also bear in mind that JPEGs decompress in memory into far
> bigger images. Are you running out of memory (or exceeding the PHP memory_limit
> setting?)
>
> --
> 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]
|