rendered paste body<style type="text/css">
body
{
font:0.7em Tahoma, sans-serif;
color:#d5b400;
}
a
{
font: 0.7em Tahoma, sans-serif;
font-size: 14px;
font-weight:bold;
color:#FFFFFF;
text-decoration:none;
}
a img
{border: none;}
a:hover
{color:#046306;}
.button
{
border:1px solid #ffffff;
font-size:10px;
background:#e7e6cf;
color: #000000;
}
input , textarea, select
{
border:1px solid #666666;
font-family:verdana;
font-size:10px;
}
/*TEXT STYLES*/
</style>
<?php
include('gauche.php');
?>
<td colspan="17" rowspan="24" valign="top" bgcolor="#6E0000" align="center">
<img src="barres/Sitev41_22.jpg" alt=""><br /><br />
<?php
error_reporting(E_ALL ^ E_NOTICE);
function miniature($file, $new_height = NULL, $new_width = NULL)
{
// definition des dossiers de destination et de source
$dir = 'galerie/'.$_GET['g'].'/';
$dest = 'galerie/'.$_GET['g'].'/miniature/';
if(!is_dir($dest))
mkdir($dest);
if($extension == "png")
$source = ImageCreateFromPng($dir.$file);
else
$source = ImageCreateFromJpeg($dir.$file);
$largeurSource = imagesx($source);
$hauteurSource = imagesy($source);
$test_h = round(($new_width / $largeurSource) * $hauteurSource);
$test_w = round(($new_height / $hauteurSource) * $largeurSource);
if(!$new_height) $new_height = $test_h;
elseif(!$new_width) $new_width = $test_w;
elseif($test_h>$new_height) $new_width = $test_w;
else $new_height = $test_h;
if(!file_exists($dest.$new_width.'-'.$new_height.'--'.$file))
{
$extension = substr($file, -3);
if($extension == "png")
{
$image = ImageCreateTrueColor ($new_width, $new_height) or die ("<h1>Erreur</h1><p>La création de l'image a échoué</p>");
ImageCopyResampled($image, $source, 0, 0, 0, 0, $new_width, $new_height, $largeurSource, $hauteurSource);
$path = $dest.$new_width.'-'.$new_height.'--'.$file;
ImagePng ($image, $path);
return $path;
}
elseif($extension == "jpg")
{
$image = ImageCreateTrueColor ($new_width, $new_height) or die ("<h1>Erreur</h1><p>La création de l'image a échoué</p>");
ImageCopyResampled($image, $source, 0, 0, 0, 0, $new_width, $new_height, $largeurSource, $hauteurSource);
$path = $dest.$new_width.'-'.$new_height.'--'.$file;
ImageJpeg ($image, $path);
return $path;
}
else
return "Erreur : seules les images png et jpeg sont accepter !!!";
}
else
return $dest.$new_width.'-'.$new_height.'--'.$file;
}
function lire_repertoire($rep, $ext)
{
$liste = array();
$dir = opendir($rep);
while($file = readdir($dir))
{
if($file != '.' && $file != '..' && !is_dir($file))
$liste[] = $file;
}
$trouve = array_values(preg_grep('`\.'.$ext.'$`', $liste));
closedir($dir);
return $trouve;
}
// definition du répertoire et de l'extension
$rep = 'galerie/'.$_GET['g'];
$ext = 'jpg';
$contenu_rep = lire_repertoire($rep,$ext);
$nombreDePhotoParPage = 30;
$totalDesPhoto = count($contenu_rep);
// On calcule le nombre de pages à créer
$nombreDePages = ceil($totalDesPhoto / $nombreDePhotoParPage);
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$premierePhotoAafficher = ($page - 1) * $nombreDePhotoParPage;
$dernierePhotoAafficher = $premierePhotoAafficher + $nombreDePhotoParPage;
foreach($contenu_rep as $key => $val){
if($key >= $premierePhotoAafficher && $key <= $dernierePhotoAafficher)
{
$i++;
echo '<a href="moyenne.php?image='.miniature($val, NULL, 497).'"><img src="'.miniature($val, NULL, 150).'" alt=""></a> ';
if($i % 3 == 0)
{
echo '<br /><br />';
}
}
}
// affichage des pages
echo 'Page : ';
for ($i = 1 ; $i <= $nombreDePages ; $i++)
echo '<a href="?page=' . $i . '">' . $i . '</a> ';
?>
<br />
<a href="Javascript:history.go(-1)">Retour à la page précédente</A>
</td>
<?php
include('droite.php');
?>