Help - Search - Members - Calendar
Full Version: Table Being Widened By An Image
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Xander
Is there an html tag that will lock in a tables dimensions? I have a table that I put as a width of 500 and height of 500, but then I put an image in one of the table details which has a default size of over 1,000 width and height. When the page loads, the full image is there instead of one that is compressed to the table's 500x500 dimensions. I can't simply put the dimensions in the img src code because I'm using a php code that will recall a certain picture based on one that is clicked, so different pictures will load into that page that might all have different sizes. Please help.
Darin McGrew
QUOTE(Xander @ Jun 23 2007, 10:22 PM) *
Is there an html tag that will lock in a tables dimensions?
No.

QUOTE(Xander @ Jun 23 2007, 10:22 PM) *
I have a table that I put as a width of 500 and height of 500, but then I put an image in one of the table details which has a default size of over 1,000 width and height. When the page loads, the full image is there instead of one that is compressed to the table's 500x500 dimensions.
You've got two basic options: crop the image or resize the image.

You can use CSS to "crop" the image by specifying the overflow property, but it's better to have your server send a cropped image file. That way you aren't wasting bandwith for a 1000px image that you're only going to show half of.

You can use HTML or CSS to "resize" the image by specifying a width of only 500px, but it's better to have your server send a resized image file. That way you aren't wasting bandwidth for a 1000px image that you're going to resize to only half that size.
Brian Chandler
QUOTE(Xander @ Jun 24 2007, 02:22 PM) *

Is there an html tag that will lock in a tables dimensions? I have a table that I put as a width of 500 and height of 500, but then I put an image in one of the table details which has a default size of over 1,000 width and height. When the page loads, the full image is there instead of one that is compressed to the table's 500x500 dimensions. I can't simply put the dimensions in the img src code because I'm using a php code that will recall a certain picture based on one that is clicked, so different pictures will load into that page that might all have different sizes. Please help.


If you have a php script recalling the images it is straightforward to get the image size, and if it's outside the limit, resize the image or whatever else is necessary.

If you wrote the script yourself this should be obvious - if not you either need to learn how to do it, or get someone to do it for you. I'm sure someone here can help with specific questions...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.