Page 1 of 1

can i dictate the size of the image?

Posted: Mon Jan 12, 2004 1:02 pm
by nutstretch
i have some code which returns results from a database. one of the results is an image. when it goes into the table it is quite large. I would like to dictate the size of image as part of my code.

below is the line of code that inserts the image into the table.

I tried placing width = "50" height = "40" after the 4th " but it didn't take any notice.

print "<td><img src=\"".$row['image']."\" ></td>";

does anyone know where I place it and if i can?


Cheer in anticipation :?

Posted: Mon Jan 12, 2004 1:20 pm
by scorphus

Code: Select all

<?php
print "<td><img src="".$row['image']."" width="50" height="40"></td>";
?>
Was this what you tried?

You could also use the Image Functions to resise the image. Also search the forum.

Regards,
Scorphus.

Posted: Mon Jan 12, 2004 3:40 pm
by nutstretch
no not quite i tried putting width="50" height = "40" after
print "<td><img src=\"".$row['image']."\" but without the slashes you added

I tried
print "<td><img src=\"".$row['image']."\" width=\"50\" height=\"40\"></td>";

and it didn't work either

Posted: Mon Jan 12, 2004 9:21 pm
by Pyrite
You can use a gd image function to find the width/height of an image dynamically. Look at the URL scorphus posted to you.