I have a script right now that works great for a FTP type site for my company resource.
It displays images with a download link and file name. What I want to do is, if the file isn't an image (like pdf) show a placeholder image.
The code below isn't right (the if/else statement), but you can see what I was going for.
Thanks in advance.
<?php
// Find all files in that folder
$files = glob('files/*');
//$image =
// Do a natural case insensitive sort, usually 1.jpg and 10.jpg would come next to each other with a regular sort
natcasesort($files);
if ($files = array("gif", "jpeg", "jpg", "png");) {
$images = $file
} else {
$images = "http://hg.exbabylon.net/find_fitter/placeholder.jpg";
}
// Display images
foreach($files as $file) {
echo '<div class="one_half"><img src="' . $images . '" class="images" /></br><h2>' .basename($file). '</h2><a class="download" href="fitter/download.php?file='.base64_encode($file).'"></a></div>';
}
?>
$filesobject ?