Re: image* Functions' Memory Usage

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

 



I recently made two commercial sites that used both GD and Imagick and
i can share some wisdom i got from those projects.

(both projects were "card" generators where users made their custom
cards and but one had a fixed picture and users could add text and the
other one allowed users to add their own picture with text)

# Some functions of the GD library are VERY memory intensive.
For example the image resizing. The resizing process is calling three
functions to work and two of them are holding very large amounts of
data within them. (the original image and the new image area you are
going to put the resized image into, and then the 3rd functions
resizes the image)

# Basic GD library functions can be quite fast (and most if not all
Imagick functions are fast if the image isn't too big)

# Speed of both options are always affected by the size of the image
being used. (Size in bytes, a 10x15 print quality card generated with
a user selected image + text can take up to 30 seconds to generate)
And yes thats an annoying generator to debug.

# If you are going beyond simple things like adding text onto an image
i recommend going with Imagick.

# Imagick is a great system to use if you learn all the command lines
and combinations, far superior to GD in many ways.

# Complex Imagick functions (that works with all possible outcomes)
can be VERY slow.

# If you have the choice of running Imagick from the command line
(installed onto the linux system) or running the Imagick PHPlib, go
with the PHP library one (even though it looks like more overhead in
code) since error reporting with the command line is close to none.

# If you have the choice of the images being generated later (ie. by
an admin of the system), go with that path always. (one of my systems
does that and the other doesn't) and the problems with the end users
on the image generating step are very hard to debug, since they
usually describe the problems very badly.

Hope this helps some.

- Ólafur Waage
olafurw@xxxxxxxxx

2008/1/4, Casey <heavyccasey@xxxxxxxxx>:
> Greetings, list.
>
> I have a web application that generates PNG images that are thousands
> of pixels high by thousands of pixels wide (using imagepng, etc.).
>
> The problem is this takes way too much memory, and the rest of the
> site becomes too slow.
>
> I'm working on something to cache the images, but some suggestions in
> the meantime would be great.
>
> Maybe ImageMagick is faster? Flash?Any suggestions? Thank you very much.
>
> - Casey
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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