Forum Moderators: coopster

Message Too Old, No Replies

Image resizing and watermarking

on-the-fly when uploading

         

nEptune

10:58 pm on Apr 4, 2009 (gmt 0)

10+ Year Member



Hi all

I am looking for a way to upload images to a website I'm working on to create multiple galleries in much the same way as many of the photograph hosting websites that you see these days. You know the ones.

I'm working in php (learning as I go as I have limited experience) and need to be able to resize a copy (by the longest dimension to create thumbnails) and watermark the original (not the thumbnail copy) as the image is uploaded.

After browsing throught the forums looking for a solution I found this thread:

[webmasterworld.com ]

although this doesn't cover watermarking, and is perhaps a little further advanced than I need at the moment.

Can anyone help?
Many thanks in advance,
Ian.

Nutter

1:39 am on Apr 5, 2009 (gmt 0)

10+ Year Member



Does you host have ImageMagick available? It's a pretty painless way to watermark.

dreamcatcher

7:53 am on Apr 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You`ll find some useful classes at the PHP Classes Repository:

[phpclasses.org...]

dc

nEptune

6:49 pm on Apr 5, 2009 (gmt 0)

10+ Year Member



Thanks Nutter.

I haven't got the hosting sorted yet, so I guess if that's the best way to do it then I should look for hosting which has it.

Can ImageMagick handle the resizing too?

Do you recommend anywhere for hosting, maybe from experience?

rocknbil

3:59 pm on Apr 6, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ImageMagick can handle resizing, cropping, compositing, hundreds of formats and conversion to/from those formats, annotation, truetype overlays, filters, montages, the list goes on . . .

imagemagick.org [imagemagick.org]

Additionally, if you decide to work with images larger than 2MB, the problem with the GD Toolkit is it takes a compressed image (say, a jpg) and works it in memory as a full bitmap, which is not compressed. This consumes an inordinate amount of memory and causes issues (among which are fatal PHP errors.) ImageMagick runs as an external process and manages it's own memory, so gets around this very gracefully.

Most "off the shelf" hosting won't have it installed, some will; however, if you're on a dedi or VPS/VDS, you can have your admin install it for you.

If you do not forsee your uploaded images exceeding 2MB, be sure to explore the GD Toolkit fully, it may likely have compositing abilities (sorry, never went that far w. it myself.)