The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Table Being Widened By An Image
Xander
post Jun 24 2007, 12:22 AM
Post #1





Group: Members
Posts: 1
Joined: 24-June 07
Member No.: 3,169



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Jun 24 2007, 12:42 AM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Jun 24 2007, 01:05 AM
Post #3


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 12:15 AM