mirror of
https://github.com/c0de-archive/GAMA-Site.git
synced 2024-12-22 09:42:39 +00:00
Automatic detection of missing thumbnails and shows nothumb.png
This commit is contained in:
parent
ea8c4d84f0
commit
cccdd39978
@ -42,16 +42,25 @@
|
||||
|
||||
function noimg(){ // Shown in place of the image if one isn't available
|
||||
$thelist = '';
|
||||
// Last Modified not working, so removed for the time being
|
||||
$thethumbs = '';
|
||||
$_SESSION['thethumbs'] = '';
|
||||
if($handle = opendir('Pictures')){
|
||||
while(false != ($file = readdir($handle))){
|
||||
if($file != "." && $file != ".." && $file != ".htaccess"){
|
||||
//$thelist .= '<a href="?img='.$file.'"><img src="thumbs/'.$file.'" alt="Thumbnail for '.$file.'" /><br /> └ '.$file.'</a></font><br /><p></p>'."\n";
|
||||
$thelist .= "-".$file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
if($thumbs = opendir('thumbs')){
|
||||
while(false != ($fiel = readdir($thumbs))){
|
||||
// Test if thumbnail exists if not show nothumb.png
|
||||
if($fiel != "." && $fiel != ".." && $fiel != ".htaccess"){
|
||||
$thethumbs .= "-".$fiel;
|
||||
}
|
||||
}
|
||||
closedir($thumbs);
|
||||
}
|
||||
echo "
|
||||
<p>
|
||||
Please specify an image with the url:
|
||||
@ -63,11 +72,16 @@
|
||||
<h4>Uploaded Pictures:</h4>
|
||||
";
|
||||
$thelist = explode("-", $thelist);
|
||||
$thethumbs = explode("-", $thethumbs);
|
||||
foreach($thelist as $pics){
|
||||
if($pics == '' || $pics == null){
|
||||
echo '';
|
||||
}else{
|
||||
}else{ // Checks if there is a thumbnail for the image, if not show nothumb.png
|
||||
if(in_array($pics, $thethumbs)){
|
||||
echo '<a href="?img='.$pics.'"><img src="thumbs/'.$pics.'" alt="'.$pics.'" title="'.$pics.'"/></a>'."\n ";
|
||||
}else{
|
||||
echo '<a href="?img='.$pics.'"><img src="nothumb.png" alt="'.$pics.'" title="'.$pics.'"/></a>'."\n ";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo"
|
||||
|
Loading…
Reference in New Issue
Block a user