Thanks Steven James but you gave two parameters which and max and than you use only one paramter in the img so can you please explain further.'
Thanks.
Main Topics
Browse All TopicsHello i need to re size on the fly an image and display smaller as the original file with maintaining it original clear aspect size ratio
How can i do that ?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello,
There are a few ways to do it but first I need to know something:
Are the images having their width and heights set? Like <img src="" width=""100 height="100" /> because if these values are not being set then you can just change the height or width and the browser will automatically keep the aspect ratio. Is this information enough or do you need to also know how to change the size of the images?
But like Steggs says, if the image is the same size on your pages, just explicitly set the image size in the tag and let the browser do the work. Not if you're looking for thumbnail, and your images are large and performance is an issue, you might want to use a tool to resize them ion the server and only show them.
Business Accounts
Answer for Membership
by: StevenJamesPosted on 2009-07-05 at 15:39:56ID: 24781554
Put this within the <head></head> section: ich);
')" src="some_image.jpg" />
<script language="javascript" type="text/javascript">
function resize(which, max) {
var elem = document.getElementById(wh
if (elem == undefined || elem == null) return false;
if (max == undefined) max = 100;
if (elem.width > elem.height) {
if (elem.width > max) elem.width = max;
} else {
if (elem.height > max) elem.height = max;
}
}
</script>
Then load your image like this:
<img id="some_image" onload="resize('some_image