All pastes #565758 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-06-14 04:15 UTC
rendered paste body
$nomrep = "photos";$rep = $nomrep."/";$dir = opendir($rep);function compter_fichiers($rep_cible) {	$files = glob($rep_cible."*");	$compteur = count($files);	return $compteur;}function dd($date) {	return date("d/m/Y H:i:s",$date);}echo 'Le dossier "'.$nomrep.'" contient '.compter_fichiers($rep).' fichiers.';echo '<table border="1"><tr>';$i = 0;while ($f = readdir($dir)) {	if(is_file($rep.$f)) {		$i++;		$size = GetImageSize($rep.$f);		if (($size[0] > 150) or ($size[1] > 150)) {			if ($size[0] <= $size[1]) {				$largeur_img = 150;				$hauteur_img = $size[1] * 150 / $size[0];			}			else {				$hauteur_img = 150;				$largeur_img = $size[1] * 150 / $size[0];			}		}		else {			$hauteur_img = $size[0];			$largeur_img = $size[1];		}		echo "<td><div align='center'><a href='".$rep.$f."'><img src='".$rep.$f."' border='0' height='".$largeur_img."' width='".$hauteur_img."'></a></div>";		echo "<ul><li>Nom : ".$f;		echo "<li>Taille : ".filesize($rep.$f)." octets";		echo "<li>Dimensions : ".$size[0]." x ".$size[1];		echo "<li>Création : ".dd(filectime($rep.$f));		echo "<li>Modification : ".dd(filemtime($rep.$f));		echo "<li>Dernier accès : ".dd(fileatime($rep.$f));		echo "</ul><br><br></td>";		if ($i % 5 == 0) {			echo "</tr>";			echo "<tr>";		}	}		else {			echo '</tr>';		}}echo '</table>';closedir($dir);?>