Hi !
Hab letzthin ein droplet für die Foldergallery gebaut, die mir gleich 12 Zufallsbilder rückliefert incl Link auf ihre gallerieseite. D.h. wenn man das anklickt landert man auf der seite wo es ist. Man sieht gleich daß man etwas händisch anpassen muß.
In aktion ist das auf
http://www.kunstverein-spectrum.de/x/pages/zufallsgalerie.php//: [[zuphall?height=<Pixel>]]
global $suffixes,$database ;
// config
$suffixes = 'jpg|jpeg|gif|png'; // recognized file suffixes for images
$root_path = WB_URL.MEDIA_DIRECTORY.'/galerie/Kuenstler' ; // Startverzeichniss
$section_id = 261 ; // sectionid dieser einen Foldergallery
$gallery_link = 'http://www.kunstverein-spectrum.de/x/pages/kuenstler.php?cat=' ;
$width = 'auto';
$height = 'auto';
// end config
$names = array();
$shuffeled = array();
$names = fg_images($section_id,$database );
$shuffeled = twodshuffle($names) ;
$count = count($shuffeled);
$name = "" ;
$a0='<div id="zuphall" >'.'<p id="alt-text"></p>' ;
$a1='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[1][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[1][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a2='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[2][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[2][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a3='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[3][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[3][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a4='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[4][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[4][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a5='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[5][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[5][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a6='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[6][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[6][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a7='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[7][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[7][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a8='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[8][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[8][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a9='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[9][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[9][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a10='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[10][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[10][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a11='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[11][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[11][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$a12='<div class="zu"><div class="zu2"><a href="' .$gallery_link.$shuffeled[12][1]. '" rel="" title="">' . '<img src="' .$root_path.$shuffeled[12][2]. '" class="zuphall" alt="' .$name. '" width="' .$width. '" height="' .$height. '" /></a></div></div>';
$ax='<div id="left-but"></div><div id="right-but"></div></div>';
return $a0.$a1.$a2.$a3.$a4.$a5.$a6.$a7.$a8.$a9.$a10.$a11.$a12.$ax.'</br>';
function fg_images($section_id,$database)
{
$files = array();
$sql = 'SELECT f.file_name as image_name, c.id as catalog_id, c.parent as parent, c.categorie as categorie FROM '. TABLE_PREFIX .'mod_foldergallery_files f,'. TABLE_PREFIX . 'mod_foldergallery_categories c WHERE c.id = f.parent_id and c.section_id = "'.$section_id. '";' ;
$query = $database->query($sql);
if ($query->numRows() == 0) {
return $files ;
}
$count = 0 ;
while ($bild = $query->fetchRow()) {
if ($bild['file_name'] == 'folderpreview.jpg')
continue;
$img = $bild['image_name'] ;
$par = $bild['parent'] ;
$cat = $bild['categorie'] ;
$count = $count + 1 ;
$files[$count][1] = $par.'/'.$cat ;
$files[$count][2] = $par.'/'.$cat.'/fg-thumbs/'.$img ;
}
return $files;
}
function twodshuffle($array)
{
// Get array length
$count = count($array);
// Create a range of indicies
$indi = range(0,$count-1);
// Randomize indicies array
shuffle($indi);
// Initialize new array
$newarray = array($count);
// Holds current index
$i = 0;
// Shuffle multidimensional array
foreach ($indi as $index)
{
$newarray[$i] = $array[$index];
$i++;
}
return $newarray;
}
Natürlich kann man das auf eines reduzieren.
geht das in die richtung ?