Ver Mensaje Individual
  #12 (permalink)  
Antiguo 14/08/2010, 15:09
Avatar de rodrypaladin
rodrypaladin
Moderador
 
Fecha de Ingreso: abril-2010
Ubicación: Madrid
Mensajes: 2.127
Antigüedad: 14 años
Puntos: 468
Respuesta: Problema con galeria de fotos php

la verdad es que si la hay no se donde puede estar porque no encuentro ningun script mas voy a intentar pegarte todo el codigo, vale ?

1º mitad:

Cita:
<?php

// ################################################## ###############//

// # script by WingNut www.freitagmorgen.de #//

// # #//

// # this script has been published under the gnu public license #//

// # you may edit the script but never delete this comment! thx. #//

// ################################################## ###############//

// --begin editable region



// Root directory

$root_dir = "http://www.escuelprocan.es/nueva/galeria";



// Thumbnail Columns

$columns = 6;



// Size of thumbnails in pixel

$thumbwidth = 100;



// Slideshow 0=no 1=yes

$slideshow = 0;



// --end editable region

//################################################## ################//

// Do not change anything by now unless you know what you are doing!

?>



<html>

<head>

<title>EasyGallery</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="author" content="Thomas Holtkötter">

<meta name="keywords" content="EasyGallery, WingNut, projects, freitagmorgen.de, www.freitagmorgen.de">

<style type="text/css">

BODY{margin:0 auto;}

*{margin:0;padding:0;}

.form{font-size:0.9em;margin:0 0 0 8px;}

.thumbnails{background-color:#FFF;border:#FFF 2px solid;}

.error{background-color:#999;width:100%;font-size:1.0em;font-weight:bold;padding:30px 0 30px 20px;}

.link{margin-left:11px;text-decoration:none;color:#666;font-size:0.8em;}

</style>

<script type="text/javascript" src="http://www.escuelprocan.es/nueva/galeria/slimbox/js/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="http://www.escuelprocan.es/nueva/galeria/slimbox/js/slimbox2.js"></script>

<link rel="stylesheet" href="slimbox/css/slimbox2.css" type="text/css" media="screen" />

</head>

<body>



<?php

// --begin preprocessing

$phpself = $_SERVER['PHP_SELF'];

extract($_POST);



// filetypes

$filetypes = array("jpg", "jpeg");

$k = sizeof($filetypes);

for ($i=0; $i<$k; $i++)

{

$filetypes[] = strtoupper($filetypes[$i]);

}



// extract local image folders

if (strpos($root_dir,'www')===0)

{

$root_dir = 'http://'.$root_dir;

}

$local = parse_url($root_dir);

if (strpos($root_dir,'http://')===0)

{

foreach (count_chars($phpself,1) as $i=>$val)

{

if (chr($i)=='/')

{

$root_dir = substr($local['path'],1);

for ($j=1;$j<$val;$j++)

$root_dir='../'.$root_dir;

}

}

if (strpos($root_dir,$local['path'])===0)

{

$root_dir = ".";

}

}



// scanning directory for folders and check if they contain image files

if (!is_dir($root_dir))

{

printError("Couldn't find a root directory. Please specify a valid directory in EasyGallery.php.");

}

$root_handle = opendir($root_dir);

while ($dirname = readdir($root_handle))

{

$var1 = strcmp($dirname,'.');

$var2 = strcmp($dirname,'..');

$var3 = is_dir($root_dir.'/'.$dirname);

if (($var1!=0) && ($var2!=0) && ($var3==1))

{

$dir_handle = opendir($root_dir.'/'.$dirname);

$postmp = 0;

while ($filename = readdir($dir_handle))

{

for ($i=0;$i<sizeof($filetypes);$i++)

{

$postmp = strpos($filename, $filetypes[$i]);

if ($postmp>0)

{

$folders[] = $root_dir.'/'.$dirname;

break 2;

}

}

}

closedir($dir_handle);

}

}

if (!$folders)

{

printError("Searched folders don't contain any image! Please change the \$root_dir.");

}



// !!! if you don't want your folders in reverse order change rsort() to sort()

rsort($folders);



// set initial variable $ordner

if (!isset($ordner))

$ordner = $folders[0];



// scanning directories for image files

if (is_dir($ordner)){

$dir_handle = opendir($ordner);

while ($filename = readdir($dir_handle))

{

for ($i=0; $i<sizeof($filetypes); $i++)

{

$pos = strpos($filename, $filetypes[$i]);

$var1 = strcmp($filename,'.');

$var2 = strcmp($filename,'..');

$var3 = is_file($ordner.'/'.$filename);

if (($var1 != 0) && ($var2 != 0) && ($var3 == 1) && ($pos > 0))

{

$files[] = $filename;

}

if ($filename=="thumbnails")

{

$thumbs = 1;

}

}

}

sort($files);

$size = sizeof($files);

closedir($dir_handle);

closedir($root_handle);

}

else

{

printError("No Folders found. Please copy your image folders to the location specified in the \$root_dir in EasyGallery.php.");

}

// --end preprocessing

?>



<?php

// --begin form

echo "<div class=\"form\">\n";

echo "<form name=\"fotoalbum\" method=\"post\" action=\"$phpself\">\n";

echo "<select class=\"form\" name=\"ordner\" onchange=\"document.fotoalbum.submit();\">\n";

while ($folder = each($folders))

{

if ($ordner == $folder["value"])

{

echo "<option selected value=\"$ordner\">";

}

else

{

echo "<option value=\"";

echo $folder["value"];

echo "\">";

}

$text = $folder["value"];

while (strrpos($text,"/"))

{

$text = substr($text, strrpos($text,"/")+1);

}



// !!! if you want to add special chars to your folders uncomment or add the lines you need



// GERMAN

//$text = str_replace("ae", "ä", $text); // Replace all ae with ä

//$text = str_replace("oe", "ö", $text); // Replace all oe with ö

//$text = str_replace("ue", "ü", $text); // Replace all ue with ü

//$text = str_replace("sz", "ß", $text); // Replace all sz with ß

//$text = str_replace("AE", "Ä", $text); // Replace all AE with Ä

//$text = str_replace("OE", "Ö", $text); // Replace all OE with Ö

//$text = str_replace("UE", "Ü", $text); // Replace all UE with Ü



// SCANDINAVIAN

//$text = str_replace("ae", "æ", $text); // Replace all ae with æ

//$text = str_replace("oe", "ø", $text); // Replace all oe with ø

//$text = str_replace("aa", "å", $text); // Replace all aa with å

//$text = str_replace("AE", "Æ", $text); // Replace all AE with Æ

//$text = str_replace("OE", "Ø", $text); // Replace all OE with Ø

//$text = str_replace("AA", "Å", $text); // Replace all AA with Å



$text = str_replace("_", " ", $text); // Replace all _ with SPACE

echo $text;

echo " </option>\n";

}

echo "</select>\n";

echo "</form>\n";

echo "</div>\n";

// --end form



// --begin print images

echo "<div class=\"form\">";

$xpos=8;

$ypos=6;

$count = 0;

$newthumbs = false;

$divheight = ceil(count($files)/$columns) * ($thumbwidth+6) + 6;

echo "<table height=$divheight width=100% cellspacing=0 cellpadding=0><tr valign=top><td>\n";

for ($y=0;$y<count($files);$y++)

{

$tn_src = $ordner."/thumbnails/tn_".$files[$count];

if (file_exists($tn_src))

{

$image = GetImageSize($tn_src);

$image[0] -= 8;

$image[1] -= 8;

if ($image[0]==$image[1]){}

elseif ($image[0]<$image[1]) $xpos += intval(($image[1]-$image[0])/2);

else $ypos += intval(($image[0]-$image[1])/2);

echo "<div id=\"livethumbnail\" style=\"left:".$xpos."px; top:".$ypos."px; position:relative; zIndex=1;\">";

if($slideshow!=1){

echo "<a href=\"".$ordner."/".$files[$count]."\" rel=\"lightbox-\"".$ordner.">";

}

else{

echo "<a href=\"".$ordner."/".$files[$count]."\" rel=\"lightbox-\"".$ordner.">";

}

echo "<img src=\"$tn_src\" class=\"thumbnails\" alt=\"$files[$count]\" style=\"width:$image[0]; height:$image[1]; left:0px; top:0px; position:absolute; zIndex=1;\"></a></div>\n";

if ($image[0]==$image[1]){}

elseif ($image[0]<$image[1]) $xpos -= intval(($image[1]-$image[0])/2);

else $ypos -= intval(($image[0]-$image[1])/2);

}

else

{

$modules = get_loaded_extensions();

if(!in_array("gd", $modules)){

printError("Your webserver doesn't provide the use of the GD library, which is required to create thumbnails. Please create and add your thumbnails manually.");

}

if(createthumb($ordner,$files[$count],$thumbwidth))

{

echo "tn_$files[$count] created.<br>";

$newthumbs = true;

}

else

{

printError("Thumbnail creation failed.");

}

}

$count++;

if($count%$columns==0)

{

$ypos += $thumbwidth+6;

$xpos = 8;

}

else

{

$xpos += $thumbwidth+6;

}

}

if($newthumbs)

{

echo "<script>location.reload()</script>";

}

echo "</td></tr></table>\n";

echo '<p><a href=http://www.freitagmorgen.de class="link">EasyGallery</a></p>';

// dont even think about removing this link!

echo "</div>\n";

?>



</body>



<?php

function printError($text)
Hay dos bien claros que son los que solucionaron el resto, pero el realiza lo de la funcion del efecto al pasar el raton por encima no lo encuentro, a ver si lo consigues ver tu

Gracias otra vez