Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scaling uploaded JPGs

Status
Not open for further replies.

jimoblak

Instructor
Joined
Oct 23, 2001
Messages
3,620
Location
US
I am charged with the task of creating a bulletin board that allows people to upload a picture of a lost pet. My concern is accepting a JPG upload and then resizing it to a tolerable size for display in a web page.

Can anyone give any pointers on a similar web application or tutorial that I can learn from? I can handle the image upload to a directory but that is as far as I can go. I am clueless about scaling down larger images to fit within a pixel dimension limit.

- - picklefish - -

Why is everyone in this forum responding to me as picklefish?
 
I just looked at it and am about to install it but I did not see anything about scaling images down.

- - picklefish - -

Why is everyone in this forum responding to me as picklefish?
 
I wrote an image gallery script a while back when playing with Classes.
I included some code in there that resized the uploaded image to make a Thumbnail for displaying in the gallery.

You can get a copy of the class here


Sample here;


It was my first attempt at a class, and image uploading, so I make no claims that it is perfect (for instance it doesn't do much error checking and it only works with JPEGs). You should be able to deploy it on any server (I think).

The scaling bit works ok though ;)

Hope it's helpful.
 
i wrote a script a couple of weeks ago that makes a thumb of the upload pic and puts it in a "thumbs" folder, then moved the original pic to "pics" folder.
it uses netPBM library, if u have it installed or plan to i can post the code ( i'll have to mess with it a bit because the final ajustments were made in a remote server and i lost it :( )

btw, it works :p

jamesp0tter,
jamespotter@netcabo.pt

p.s.: sorry for my (sometimes) bad english :p
 
DOH - Call me an idiot. I was totally overlooking thumbnailing as being akin to what I need to do.

I was so wrapped up in working out the logic for the rest of the pet bulletin board that I totally ignored the bazillion thumbnail-making snippets of code that are available on the net.

Foamcow: I'm assuming that since you shared your class that you do not have personal licensing issues with it. If I decide to use portions of it and offer my final project on sourceforge.net, should/could I include some sort of remark of credit to you?



- - picklefish - -

Why is everyone in this forum responding to me as picklefish?
 
jimoblak,

Have you looked into GD for php for resizing images into thumbnails?

Hope this helps!

Nate

mainframe.gif

 
No probs mate, you carry on.
A credit would be nice (but the code could proably do witha bit of "refining" ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top