Forum Moderators: coopster

Message Too Old, No Replies

resizing graphics during upload

         

michlcamp

4:56 pm on Nov 6, 2005 (gmt 0)

10+ Year Member



I have a site with a lot of members who can maintain their own web page, entering text, uploading grahics, the usual. The biggest problem on the site is that a lot of members don't know how to resize their digital pictures and just upload the originals - way too much filesize, of course. I could set a maxfilesize on the upload (and will) but I'd rather put the graphic through a resize process on upload to insure it's the size it needs to be to work with the page.

I'd like to create scale thumbnails with the same name as original and then delete the original graphic. I should end up with graphic files that have approximately the same xy dimensions (scaled from orig) and filesize.

Hoping you might get me going in the right direction for this.
Thanks,
mc

mcibor

5:03 pm on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know that ImageMagic and gd can do resizing of the picture.
You can try them out. There should be a manual somewhere out there!

Michal Cibor

ergophobe

5:12 pm on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For just resizing/resampling, and setting jpeg quality, I would recommend ImageMagick. It's just simpler than GD and may still have a tiny quality edge (over GD2; it has a huge quality edge over GD1).

It is installed by default on most *nix machines these days as it ships with most *nix distros, but it is not difficult to install the binaries in *nix or Win. Then you make a system call to ImageMagick from within PHP, so you need permissions to do that. It's very simple, though. Literally just a couple of lines of code (only one line for the resize itself).

If you get stuck, lots of people here can help.

If you can't use ImageMagick, it's just a tiny bit more complicated to do it wth GD.

michlcamp

2:24 am on Nov 7, 2005 (gmt 0)

10+ Year Member



How can I tell if ImageMagick is installed on the server? I tried phpinfo.php but didn't see any reference to it.
any help appreciated..would like to get this working tonight.
mc

NomikOS

3:12 am on Nov 7, 2005 (gmt 0)

10+ Year Member



well, now it's nitgh (for me), then in the hurry i recommend you search on www.phpclasses.org, you must be a member but sure you find you need (i did much times). GD is installed on almost all PHP webhosting.

good luck.-

please tell us about your results.-

----------------
(i hope don't be opposite with the rules of the site, than suggest: "try doing by your self"
if it is, please someone tell me)

jatar_k

3:31 pm on Nov 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could try this for GD
Image upload and Thumbnail Generator [webmasterworld.com] msg 29

ergophobe

5:58 pm on Nov 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hopefully you've just done it by now with GD, which is fine.

You'll notice that most gallery scripts(Gallery, Coppermine) prefer ImageMagick or NetPBM. If you're doing a lot with images, it's worth finding out whether they're on you system.

Basically, ImageMagick is completely separate from PHP, so it won't show in phpinfo(). You need to issues system call. There are three easy ways to find out whether or not it's installed on your system

1. Ask support if it's there and what the path to access is.
2. Try it and see if it works.
3. Look at your path and see if something like ImageMagick is in your path.