[pmwiki-users] Best Place to Resize an Image . . .

Ben Wilson dausha at gmail.com
Tue Apr 11 11:30:39 CDT 2006


It's okay if you don't know how I did it. It was not a web server that
did the processing. We had a dedicated server that handled the
resizing. I'm really not at liberty to discuss those details.

Question remains: where in the upload flow should I instantiate?

On 4/11/06, H. Fox <haganfox at users.sourceforge.net> wrote:
> On 4/11/06, Joachim Durchholz <jo at durchholz.org> wrote:
> > H. Fox schrieb:
> > > On 4/10/06, Ben Wilson <dausha at gmail.com> wrote:
> > >> I want to automatically create thumbnails of uploaded images when they
> > >> exceed a certain size. I know "how" to do this, since I used to do the
> > >> same thing to images up to 4.5GB in size.
> > >
> > > Using a web server?  If so, I'm very curious how you are doing that.
> >
> > Use gdlib. It's part of the standard install of PHP (see
> > http://www.php.net/manual/en/ref.image.php ).
> > The usual sequence is:
> > * getimagesize (also provides the image type)
> > * imagecreatefromgif/imagecreatefromjpeg/imagecreatefrompng
> > * imagecreatetruecolor (with the intended target size)
> > * imagecopyresampled (fallback: imagecopyresized)
> > * imagegif/imagejpeg/imagepng
>
> I'm familiar with GD because I use it in Qdig, my GPL image gallery
> script.  I contributed a function to determine the GD version to PHP
> documentation about a year ago.
>
> http://us2.php.net/manual/en/function.gd-info.php#52481
>
> One essential step you left out, for large images at least, is getting
> the source image out of memory using imagedestroy() before the last
> step of converting the resized one to a compressed format.  I learned
> about that by not doing it Qdig's original GD conversion code and
> getting support requests from people experiencing "Allowed memory size
> exhausted" errors.  :-)
>
> I don't think you can convert a 4.5GB file with a web server,
> especially using GD.  AMOF I suspect almost no typical webserver could
> convert a 4.5MB compressed JPEG image using GD because PHP's
> memory_limit will become exhausted, probably a few times over.  A
> 4.5MB true-color image will expand to something like 40 or 50 MB in
> memory, and there still needs to be room for the resampled version.
> The default PHP memory_limit is 8MB.
>
> More info:
>
>     http://qdig.sourceforge.net/Support/AllowedMemorySize
>
> Hagan
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>


--
Ben Wilson
" Mundus vult decipi, ergo decipiatur"




More information about the pmwiki-users mailing list