Php Code: How To Show Image Width And Height From A Folder Using Php
________________________________________________________
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
In this Php Tutorial we will Learn How To Get And Display Images size ( width & height) From Folder Using Php .
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
Php Source Code:
<?php
$dir_path = "images/";
if(is_dir($dir_path))
{
$files = scandir($dir_path);
for($i = 0; $i < count($files); $i++)
{
if($files[$i] != '.' && $files[$i] != '..')
{
echo "File Name -> $files[$i]<br>";
$imageSize = getimagesize("$dir_path$files[$i]");
echo " -Image Width : $imageSize[0]<br>";
echo " -Image Height : $imageSize[1]<br>";
//jpg or png or gif .........
echo " -Image Type : $imageSize[2]<br>";
echo " -Image Width And Height: $imageSize[3]<br>";
// display the images
echo"<img src='$dir_path$files[$i]' style='width:100px;height:100px;'><br><br>";
}
}
}
Bagikan
Php : How To Get Image Size From Directory Using Php
4/
5
Oleh
insurance