Version: 1.0
Type: Full Script
Category: Graphics
License: GNU General Public License
Description: This is a basic code snippet,useful for PHP newbies, which lets the user browse through the local system and get the dimensions of gif/jpg files along with viewing the image. Compatible with the PHP 4.0/Apache 3.0 and later versions.
<html>
<title> Image Properties Viewer </title>
<body>
<center>
<h2> Image Properties Viewer </h2>
<form action="<?php echo $PHP_SELF ?>">
<input type="file" name="str"> <br> <br>
<input type="submit" name="submit" value="Submit" >
</center>
</form>
</body>
</html>
<?php
if ($submit)
{
$img = str_replace('\\\\','\\',$str); /*to remove the double backslash sent by default*/
$h = getimagesize($str);
if ($str="")
{
echo " <center> <b> Please enter a valid image! </b> </center> ";
}
else
{
echo "<center> <table border='5' bordercolor='black'>";
echo "<tr bgcolor='#efefef'> <td align=center> <b> The Image </b> </td>";
echo " <td align=center> <b> Image Dimensions </b> </td> </tr>";
echo "<tr> <td align=center> <b> <img src = '$img'> </b> </td> ";
echo " <td align=center > <b> $h[3] </b> </td> </tr>";
echo "</table>";
echo "</center>";
echo "<br>";
}
}
?>