<?php
$Directory="photos";
$Thumbs="miniatures";
$percent = 0.1;
header('Content-type: image/jpeg');
if (is_dir($Directory) && is_readable($Directory))
{
if ($MyDirectory = opendir($Directory))
{
while(false !== ($Entry = readdir($MyDirectory))) {
if (($Entry != ".") && ($Entry != "..") && ($Entry != "$Thumbs") && ($Entry != "Thumbs.db"))
{
$img_url = "photos/"..$Entry;
$img_dest = "photos/miniatures/".$Entry;
$img = imagecreatefromjpeg($img_url);
list($width, $height) = getimagesize($img_url);
$new_width = $width * $percent;
$new_height = $height * $percent;
$nimg = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($nimg,$img,0,0,0,0,$new_width,$new_height,$width,$height);
imagejpeg($nimg,$img_dest,100);
}
}
closedir($Mydirectory);
}
}
?>
</code>
2) afficheminiatures.php
<code>
<?php
$Directory="photos";
$Thumbs="miniatures";
if (is_dir($Directory) && is_readable($Directory))
{
if ($MyDirectory = opendir($Directory))
{
while(false !== ($Entry = readdir($MyDirectory)))
{
if (($Entry != ".") && ($Entry != "..") && ($Entry != "$Thumbs") && ($Entry != "Thumbs.db"))
{
echo '<a href="" alt="'."$Entry".'" src="" /></a> '; }
}
closedir($MyDirectory);
}
}
?>
</code>
Me demander, en privé, le lien public vers le serveur apache2 de mon raspberry.pi pour voir ce que ça donne.
Gérard