Aquí va el código de esta galería:
http://yuyuniz.sytes.net/galeria.php Código PHP:
<?php
include "header.inc";
include "titles.inc";
function IntToStr($int)
{
if ($int<10)
{$str="00".(string)$int;}
elseif ($int<100)
{$str="0".(string)$int;}
else
{$str=(string)$int;}
return $str;
}
$gid = (string)$_GET['id'];
$pid = (string)$_POST['pintura'];
if ($gid>$pid) {$id=$gid;}
elseif ($gid<$pid) {$id=$pid;}
else {$id="001";}
$tot = 37;
$nid = (int)$id;
echo '<title>Pinacoteca de Yuyuniz Navas</title>';
echo '<div id="rightside">';
echo '<p><form action="galeria.php" method="post">';
echo ' <select name="pintura">';
for ($q=1;$q<($tot+1);$q++)
{
$p=IntToStr($q);
if ($p==$id)
{echo '<option value="' . $p . '" selected>' . $p . '</option>';}
else
{echo '<option value="' . $p . '">' . $p . '</option>';}
}
echo '</select><input type=submit value="Ver"></p>';
echo '<p>';
if ($nid==1)
{$p1="002";$p2="003";$p3="004";$p4="005";}
elseif ($nid==2)
{$p1="001";$p2="003";$p3="004";$p4="005";}
elseif ($nid==($tot-1))
{$p1=IntToStr($tot-4);$p2=IntToStr($tot-3);$p3=IntToStr($tot-2);$p4=IntToStr($tot);}
elseif ($nid==($tot))
{$p1=IntToStr($tot-4);$p2=IntToStr($tot-3);$p3=IntToStr($tot-2);$p4=IntToStr($tot-1);}
else
{$p1=IntToStr($nid-2);$p2=IntToStr($nid-1);$p3=IntToStr($nid+1);$p4=IntToStr($nid+2);}
echo '<a href="galeria.php?id=' . $p1 . '"><img src="gal/' . $p1 . 'b.jpg"></a>';
echo '<a href="galeria.php?id=' . $p2 . '"><img src="gal/' . $p2 . 'b.jpg"></a>';
echo '<a href="galeria.php?id=' . $p3 . '"><img src="gal/' . $p3 . 'b.jpg"></a>';
echo '<a href="galeria.php?id=' . $p4 . '"><img src="gal/' . $p4 . 'b.jpg"></a>';
echo '</p></div>';
echo '<a id="main"></a>';
echo '<div id="content">';
echo '<center><h1>Pintura ' . $id . '</h1></center>';
echo '<a href="gal/' . $id . '.jpg" target="_blank">';
echo '<p><img class="photo" src="gal/' . $id . 'a.jpg"></p></a>';
echo '<p class="hide"><a href="#top">Back to top</a></p>';
include "footer.inc";
?>
Lo que hace es administrar imágenes almacenadas en la carpeta gal
Las imagenes originales se guardan con el siguiente formato 001.jpg
Para no hacer más liviana la carga de imagenes y evitar que se redimensionen en tiempo de ejecución, lo que hice fue redimensionarlas manualmente con Irfanview (lo mejor que conozco en redimensión) limitando sólo el ancho de la imagen principal a 330 pixeles (conservando el aspecto y sin restringir el alto) guardando la imagen con el formato 001a.jpg
Las imagenes menores las redimensioné a 80x80 pixeles, perdiendo parte del contenido para no distorcionarlas. Dichas imagenes se guardaron como 001b.jpg
En header.inc titles.inc y footer.inc va información html de acuerdo a su diseño
Obviamente todo lo anterior está ajustado para el template que utilicé, así es que será tarea de Uds. ajustarlo a sus propios templates, así es que ojo con los div id y class.
Quedo atento a resolver cualquier duda al respecto
ASLAN