Skip to content

Instantly share code, notes, and snippets.

@rooven
Created July 25, 2011 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rooven/1103590 to your computer and use it in GitHub Desktop.
Save rooven/1103590 to your computer and use it in GitHub Desktop.
Codigo para galeria simple php sin bd
<title>Galería de fotos</title>
<style type="text/css">.newStyle1 {
font-family: Arial, Helvetica, sans-serif;
}
.imagen{
width:300px;
padding:2em;
float:left;
}
</style>
</head>
<body>
<div id="galeria" class="galeria">
<h2>Galería de imágenes</h2>
<?php
//Solo tienen que cambiar el directorio de las imagenes en "dir", y en el link del archivo
// y ajustar los divs a su diseño, lo importante es el codigo php
$NAMEFILE = "galeria.php";
$dir = opendir("imgs/slider/");
while ($file = readdir($dir)) {
if ($file != "." && $file != ".." && $file != "$NAMEFILE") {
$data[$file]='<div class="grid_3 imagen"><a href="imgs/slider/'.$file.'" target="_blank"><img src="imgs/slider/'.$file.'" alt="'.$file.'" title="'.$file.'" width="90%" height="90%" /></a></div>';
}}
rsort($data);
while(list($k,$v) = each($data)) { echo $v; }
clearstatcache();
echo "<br />";
?>
</div>
<div><p><small>Cortesía de <a href="http://www.román-paladino.info" rel="external">Roman Paladino, modificado por rooven</a>.</small></p></div>
</body>
</html>
@ZohanGzz
Copy link

Muchisimas gracias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment