How to put there size, I want to display edge image in 400X400 format:
Please give the code size in 400X400, thanks.
Here is the code:
<?php
// Grab the data from our people table
$sql = "select * from njerz";
$result = mysql_query($sql) or die ("Could not access DB: " . mysql_error());
while ($row = mysql_fetch_assoc($result)) {
echo "<div class=\"picture\">";
echo "<p>";
// Note that we are building our src string using the filename from the database
echo $row['fname'] . " " . $row['lname'] . "<br />";
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" /><br ;
echo "</p>";
echo "</div>";
}
?>
I don't know if I understood correctly:
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" height=\"400\" width=\"400\" /><br />";
that's all you need if you want to set the dimensions
您只需要添加样式属性style="width:400px; height:400px;"
echo '<img src="images/'. $row['filename'] .'" style="width:400px; height:400px;" alt="" /><br />';
Please check my code
list($width, $height, $type, $attr) = getimagesize("PATH_OF_THE_IMAGE/".$row['filename']);
echo "<img src=\"images/" . $row['filename'] . "\" alt=\"\" height=\"".$height."\" width=\"".$width."\" /><br />";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.