Page 1 of 1

picture size in tables

Posted: Wed May 08, 2002 6:32 pm
by Denisem
does anyone know how I set all my pics in a table to the same size? I have a form that pulls pic paths from an mysql db. The problem is the pics are different sizes. How do I make them uniform?

Thanks,
Denise

Posted: Wed May 08, 2002 6:42 pm
by samscripts
Hi Denise,

if you just want to display the pics the same size, i think you can just specify it in the <img> tag like this:

Code: Select all

<img src="yourpicture.jpg" width="thewidthyouwantdisplayed" height="theheightetc">
or using code you posted before:

Code: Select all

echo "<img src="http://www.umuc.edu/~em680a10/" . $row&#1111;"image"] . "" border="0" width="120" height="120">";
(assuming you want the images to be 120x120)

The only problem with this is if the images are not all in proportion - some of them will end up looking squashed.

hope this helps, :) Sam

Posted: Wed May 08, 2002 6:43 pm
by riley
It can be a simple as this

$picpath = mysql_result($result,$i,"filename");

<IMG Border='0' Width='180' Alt='Photo' Src=$picpath>

you can also add a height component but the ratio may distort the picture.

Posted: Wed May 08, 2002 6:55 pm
by Denisem
samscripts wrote:Hi Denise,

if you just want to display the pics the same size, i think you can just specify it in the <img> tag like this:

Code: Select all

<img src="yourpicture.jpg" width="thewidthyouwantdisplayed" height="theheightetc">
or using code you posted before:

Code: Select all

echo "<img src="http://www.umuc.edu/~em680a10/" . $row&#1111;"image"] . "" border="0" width="120" height="120">";
(assuming you want the images to be 120x120)

The only problem with this is if the images are not all in proportion - some of them will end up looking squashed.

hope this helps, :) Sam

Sam - awesome - works like a charm. .....Thanks!!!

Posted: Thu May 09, 2002 9:01 am
by mydimension
being the CSS fan i am here is my two bits:

make a CSS selector like this:

table img {
width: /* the size you want */
height: /* the size you want */
}

this will then be applied to every img tag contained within all tables

I agree with mydimensin

Posted: Fri May 10, 2002 4:14 pm
by gotDNS
I am a huge CSS fan as well, definately go with mydimension on this one.

Also, DON'T FORGET YOUR SEMICOLENS AT THE END OF EACH PROPERTY :D .

Code: Select all

table img &#123; 
width: /* the size you want */ ;
height: /* the size you want */ ;
&#125;