client side image resizing???

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
nleco
Forum Newbie
Posts: 9
Joined: Mon Oct 11, 2004 4:50 pm

client side image resizing???

Post by nleco »

I have a website, where I allow people to upload pictures up to X K in size. This runs under PHP.

My question is: Is there a way to use a combination of Javascript/PHP to resize pictures on the client's side? or maybe some links to some free opensource software that my users can use to resize images?

If not, what would be best on the server side. We currently use ImageMagick for some of our image needs.

thank you.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

i use the gd library in php for graphic manipulation because it was there.
As far as I know you can't resize images using javascript but you can limit the file size which might help so you don't get those monster files being uploaded.
check out the options for <input type="file" /> it is something like max_file_size= someNumber.

Otherwise free resizing tools check out download.com or tucows for something on the client side that they can download and use.

phpScott
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you're using ImageMagik you could continue using that or the GD library. Probably an idea to set a maximum size of image so that you don't have to spend too much server energy doing this work. Users could have a go with the Gimp - http://www.gimp.org/ - free and opensource :)

Mac
nleco
Forum Newbie
Posts: 9
Joined: Mon Oct 11, 2004 4:50 pm

thanks

Post by nleco »

thanks for the ideas. I felt it was impossible to do this. Yes, i was considering some kind of server side application, but that would require server processing time. I just wasnt sure if anyone has dealt with this, or maybe even partnershiped with an outside company. if you've heard of anything like this, please let me know.

and yes, i've looked into the opensource community, it's where i went to first. :) and yes, we do limit uploads, however not through the input field. I wasnt sure that was possible, thanks for that idea!
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Re: thanks

Post by twigletmac »

nleco wrote: we do limit uploads, however not through the input field. I wasnt sure that was possible, thanks for that idea!
It can be circumvented but at least it saves your server some hassle.

Mac
nleco
Forum Newbie
Posts: 9
Joined: Mon Oct 11, 2004 4:50 pm

Post by nleco »

i asked the original question because some of my users try to upload pictures way bigger than the max upload size.

I am trying to find a way to convert the image to a smaller size either through:
1) the client's computer
2) our servers (last measure)

I'd like to implement this so that it ties in nicely with our website. the second option sounds easy, since i can resize a picture and get it bellow my required limit. however, that would mean we'd have to use our servers.

any ideas?
User avatar
potsed
Forum Commoner
Posts: 50
Joined: Sat Oct 09, 2004 12:00 pm
Location: - South Africa

Post by potsed »

irfanview is an excellant image tool that is freeware... small and easy to use too..

http://www.irfanview.com
Post Reply