Click here to Skip to main content
15,913,301 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
Dear Sir,

Example :

<table>
<tr>
   <td height="50px" width="50px">
      <img src="Nature.jpg"/>
   </td>
   <td>
      <p>Name :Mohan</p>
      <p>Address</p>
      <p>Contact</p>
   </td>
</tr>
<tr>
   <td height="50px" width="50px">
     <img src="Image.jpg"/>
   </td>
   <td>
      <p>Name :Kumar</p>
      <p>Address</p>
      <p>Contact</p>
   </td>
</tr>
</table>

Note My Image Size is,
nature.jpg(height:500px,Width:400px) and
Image.jpg(height:700px,width:500px)

How to set these images to based my table td width and height

I mean need for same size of out put in my page


reply me.
Posted
Updated 31-Jan-12 21:08pm
v2

OK, it can make some sense. Here is what you can do:

First of all, images can have different aspect ratio. So, first of all, decide if you want same width or same height. Even if the aspect ratio is the same, always specify only width or only height, never both — just in case. Or, the width of one image should match the height of another one, or any other relationships between sized. It should be defined by your layout and design.

Specify it in the image tag (not table elements or something like that):
HTML
<img src="myFile.png" width="400" alt="My image" />
or
HTML
<img src="myFile.png" width="500" alt="My image" />

Try to make it so the original image size is only the same as the rendered size or a bit bigger, so it can only scaled (re-sampled) down, not up. Your image will be re-sampled automatically by the browser. Well, minor enlargement can be satisfactory, but any considerable enlargement can look really ugly, even if you use the finest off-line algorithm.

In all cases, it's the best to keep only minor level of re-sampling in browser. The ideal situation is the exact size match with the source image. If you scale down too much, you waste considerable amount of bandwidth. If you scale up just a bit to much, it's even worse — please see above. If you need to change rendered image sizes, try to replace the source images with the images of different size.

—SA
 
Share this answer
 
v3
Comments
Mohankumar.Engain 1-Feb-12 10:03am    
hi SAKryukov,
I need my image automatically increased/Decreased height and width based on my <td> size. I give my <td height="70px" width="50px">
So, image will fix that area. whatever we want insert image size height=100px and width=200px td size only display

Give me solution?
Fix the height and width of the img tag
HTML
<img src="smiley.gif" alt="Smiley face" height="500" width="500" />
 
Share this answer
 
Comments
Mohankumar.Engain 1-Feb-12 10:03am    
Hi Anuja Pawar,

I need my image automatically increased/Decreased height and width based on my <td> size. I give my <td height="70px" width="50px">
So, image will fix that area. whatever we want insert image size height=100px and width=200px td size only display

Give me solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900