Code: Select all
echo "<table align='center' border='0' width='400' >";
echo "<tr>\n
<td align='center'><img border='0' src=\"".htmlspecialchars($imagetouse)."\"></td>
</tr>";
echo "<tr>\n
<td> </td>
</tr>";
echo "</table>\n";Code: Select all
$mysock=getimagesize($imagetouse);array(7) {
[0]=> int(650)
[1]=> int(478)
[2]=> int(2)
[3]=> string(24) "width="650" height="478""
["bits"]=> int(8) ["channels"]=> int(3) ["mime"]=> string(10) "image/jpeg" }
Which is correct - so I have the following function IMMEDIATELY FOLLOWING THE getimagesize function
Code: Select all
$mysock=getimagesize($imagetouse);
function imageResize($width, $height, $target) {
//takes the larger size of the width and height and applies the formula accordingly...this is so this script will work
dynamically with any size image
if ($width > $height) {
$percentage = ($target / $width);
} else {
$percentage = ($target / $height);
}
//gets the new value and applies the percentage, then rounds the value
$width = round($width * $percentage);
$height = round($height * $percentage);
//returns the new sizes in html image tag format...this is so you
can plug this function inside an image tag and just get the
return "width=\"$width\" height=\"$height\"";
}Code: Select all
echo "<table align='center' border='0' width='400' >";
echo "<tr>\n
<td align='center'><img border='0' src=\"".htmlspecialchars($imagetouse)."\" imageResize($mysock[0], $mysock[1], 150)
></td>
</tr>";
echo "<tr>\n
<td> </td>
</tr>";
echo "</table>\n";Thank you