All images must be resized if width exceeds max width

All images must be resized if width exceeds max width

Hi!

Well im really new to jquery. But i think this can be done with jquery byt i do not know how!

this is what i want:
I currently have a website where i share thoughts with my friends (some kind of forum) and within this 'forum' people can post pictures they made but most of the time these pictures exceed the max width of my website so my website gets all streched out!

So this is what i want: all images on the page must run thru some sort of function which checks if the image image width exceeds the max_width. if it does then the script must calculate how many pixels the current width exceeds the max_width and get this number so that the script does: current_width = current_width - (max_width - current_width). do you guys have any solutions for this?

or can u help me?

Ps. Sorry for bad english i hope i am clear enough