index.php
Código HTML:
<div id="titulo1"> <a href="./" onclick="Pagina('1')">Primero</a> <a href="?pag=4" onclick="Pagina('4')">Anterior</a> <a href="?pag=6" onclick="Pagina('6')">Siguiente</a> <a href="?pag=15" onclick="Pagina('15')">Ultimo</a><body> <?php # Inicia uma Sessao @session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Galeria</title> <style type="text/css">p{font-family:arial,sans-serif}</style> <link rel="stylesheet" href="css/galeria.css" type="text/css" media="screen" /> <link media="screen" rel="stylesheet" href="css/colorbox.css" /> <script src="js/jquery.min.js"></script> <script src="js/jquery.colorbox.js"></script> <script type="text/javascript"> function drop(url) { document.getElementById("opt").innerHTML = "Deseja apagar o arquivo \""+url+"\" ? <br><br> <button onclick=\"udrop('"+url+"')\">sim</button> <button onclick=\"cancel()\">não</button>" document.getElementById("opt").style.display = 'block'; } function cancel() { document.getElementById("opt").style.display = 'none'; } function udrop(url) { window.location.href = 'delfile.php?file='+url; } </script> </head> <body> <div id="wrap"> <p> </p> <p> </p> <hr> <p> </p> <div id="gallery"> <!-- Incluindo o programa que le o diretorio de fotos --> <? include 'lerdir.php'; ?> </div> </div> <div id="footer"> <p id="opt"> </p> </div> </body> </html> </div>
thumbnail.inc.php
[URL="http://pastebin.com/FV0pEKs8"]Esta en pastebin po cuestiones de espacio[/URL]
thumb.php
Código PHP:
Ver original
<?php # author : Rafael Clares # Inclui a classe thumbnail include_once('thumbnail.inc.php'); # Cria nova thumb da imagem recebida por get $thumb = new Thumbnail($_GET['img']); # Seta o tamanho da thumb $thumb->resize(120,120); # Exibe a imagem $thumb->show(); exit; ?>
ledir.php
Código PHP:
Ver original
? # author : Rafael Clares # Diretorio de fotos $dir = "fotos"; # Extensoes permitidas $exts = array('jpg','png','jpeg','gif','bmp'); if (is_dir($dir)) { $onload = ""; $alb = ""; $k = 0; if ($d = opendir($dir)) { while (($file = readdir($d))!== false) { if (filetype($dir.'/'.$file) == 'file') { # recupera a extensao do arquivo $extensao = explode(".", $file); for($i=0; $i<=count($exts)-1; $i++) { if($extensao[1] == $exts[$i]) { if(!isset($_SESSION['logado'])) { # Criando o link da imagem pra o lightbox e exibindo a thumb $alb .= "<a href=\"$dir/{$file}\" rel=\"ex0\" title=\"\"><img border=\"0\" src=\"thumb.php?img=$dir/{$file}\"></a>\n"; } else { # Criando o link da imagem pra excluir a imagem //$alb .= "<a href=\"javascript:drop('$dir/{$file}')\"> <img src=\"thumb.php?img=$dir/{$file}\" class=\"thumb\"></a>\n"; $alb .= "<a href=\"$dir/{$file}\" rel=\"ex0\" title=\"\"><img border=\"0\" src=\"thumb.php?img=$dir/{$file}\"></a>"; $alb .= "<img src=\"images/delete.gif\" style=\"cursor:pointer\" title=\"remover foto\" border=\"0\" onclick=\"drop('$dir/{$file}')\">\n"; } } } } $onload .= " $(\"a[rel='ex$k']\").colorbox();\n"; } closedir($d); } } ?> <script> $(document).ready(function(){ <?=$onload?> $("#click").click(function(){ $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here."); return false; }); }); </script> <?=$alb?>