Re: Re: php-general Digest 25 Jan 2008 07:59:28 -0000 Issue 5255

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 25, 2008 3:43 AM, Emil Edeholt <emil@xxxxxxxxxxxx> wrote:
> Hi!
>
> I have a website where people can upload photos and it creates previews.
> My problem is with pictures with big dimensions like 12000px height for
> example where the script times out. I've seen other sites that seems do
> be able to do this faster. I use gd to scale the image. Is there a
> faster way of doing it? Is ImageMagick better for example?
>
> Kind Regards Emil
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

That should kill your script because of memory concerns.  Tell your
users to be kind and resize their images to something sane before they
shove them at your script.  Of course if you don't care about that,
you can always ignore time limit and bump up the memory limit too.

I think the memory size can (sort of) be determined by width * height
* bits * channels / 8.  I've never found anything better than that.
There are a few comments on the php site in the gd section about such
things but I've never seen it work 100%.  I always set the real memory
limit much higher than what I say the max is for the memory size just
in case it gets an image that could break it.  At least that stopped
the friendly white screens of death. :)

If anyone has better ways of handling this I'd love to hear them.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux