can i dictate the size of the image?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
nutstretch
Forum Contributor
Posts: 104
Joined: Sun Jan 11, 2004 11:46 am
Location: Leicester

can i dictate the size of the image?

Post 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 :?
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post 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.
nutstretch
Forum Contributor
Posts: 104
Joined: Sun Jan 11, 2004 11:46 am
Location: Leicester

Post 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
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post 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.
Post Reply