Im bassically trying to create thumbnails for my uploads page, if the thumb isnt there then it creates one. However, it seems to be doing just one at a time and im having to refresh to see another.
this is my code
$thumb comes from a resize script.
i cant understand how it works but then doesnt in the next item in the loop, yet does when you refresh.
this is my code
Code:
foreach ($files as $filename) {
$current_year = date('Y', filemtime($filename));
$current_month = date('F', filemtime($filename));
if($current_year != $previous_year) echo '<br><font size=+1><b>' . $current_year . '</b><br><br></font>';
if($current_year == date('Y')){
if($current_month != $previous_month) echo '<i><br><b>'.$current_month.'</b><br><br></i>';}
$sizeoffile = (filesize($filename)/1024);
$dateoffile = date("d/m/Y",filemtime($filename));
$thumbfilename = 'thumb/'.$filename;
if (file_exists($thumbfilename)){
echo '<img height="50" width="50" src="http://www.mattinglis.com/thumb/'.$filename.'"> ';
}else{
chmod($filename, 0777);
$thumb=new thumbnail('http://www.mattinglis.com/'.$filename);
$thumb->size_auto(90);
$thumb->save($thumbfilename);
echo '<img height="50" width="50" src="http://www.mattinglis.com/thumb/'.$filename.'"> ';
}
echo '<a href="http://www.mattinglis.com/'.$filename.'">'.$filename.'</a> --- <b>Filesize</b> : '.number_format($sizeoffile, 2, '.', '').' KBytes ----- <b>Modified</b> : '.$dateoffile.'<br>';
$previous_year = $current_year;
$previous_month = $current_month;
}
$thumb comes from a resize script.
i cant understand how it works but then doesnt in the next item in the loop, yet does when you refresh.