<?php
foreach (glob("*.jpg") as $filename) {
echo "$filename size " . filesize($filename) . "<br>";
echo '<img src="'.$filename.'" height=150px><br>';
}
?>
using that code, i am able to display all the images in the folder i want to display only one that meets a size parameter, and if there are more ignore them basically want to display the one thats like a box
and alternatively i want to display only the first image of that foreach loop and if there are no images display a default image
EDIT so
<?php
foreach (glob("*.jpg") as $filename) {
$info = getimagesize($filename);
if ($info[0] == $info[1]) {
echo "$filename size " . filesize($filename) . "<br>";
echo '<img src="'.$filename.'" height=150px><br>';
break;
}
}
?>
gives you an image if its a box, (thanks to schnaader) right but images that come close to a box should be included too, how can that be sorted, meaning if the height divided by width gives more than 1