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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript picture resize before display

Status
Not open for further replies.

rileypetty

Programmer
Jan 20, 2007
43
US
Hi, Hope someone can answer a question regarding displaying pictures on web pages. We have a couple of pages on our family website that we use for blogging. I added some asp code to allow members to upload pictures at the same time and it all works just fine. There is a javascript filter on the front (written by someone else) that limits picture size but it never occurred to me that members might link to a picture on another website that’s larger than the space allowed on the web page. Once in a while a picture displays that blows away the table that it’s supposed to fit in. Is there some sort of javascript resizing function that I could wrap around the text box, where members enter the link, that would resize a picture before display. Thanks for any information you may be able to give me. Riley
 
All you have to do is set the height and width attributes on the image tag to fix this problem.

Code:
<img src="whatever.jpg" width="[!]xxx[/!]" height="[!]yyy[/!]" />

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Thanks very much for the response and help. It works just fine. Good thing I don't do this for a living:) Riley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top