Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 12:38:44 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155557 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Random Image Bild mit Link  (Read 150 times)
lumpiDumpi

Offline Offline

Posts: 2


« on: January 16, 2012, 10:29:59 AM »

Hallo zusammen,

ich bin frisch registriert und starte mal mit einer Frage.

Ich habe Random Image in meine Websitebaker Installation installiert. Ich möchte jetzt aber gerne zu jedem Bild ein Link haben, der entsprechend des Bildes auch passt. Gibt es eine solche Möglichkeit mit Random Image oder könnt Ihr mir ein anderes Droplet/Plug-in empfehlen?

Vielen Dank und noch einen top Montag
Logged
jacobi22
Betatester
*
Offline Offline

Posts: 1376


WWW
« Reply #1 on: January 16, 2012, 12:16:07 PM »

Was für Links sollen das denn sein?
RandomImage erstellt ein Zufallsbild aus einem anzugebenen Ordner unterhalb des Media-Ordner. Man könnte nun etwas basteln, das vom Bildnamen auf eine Page-ID schließen läßt und dann so den Link zaubert. So was in der Art habe ich hier irgendwo schon mal gelesen.
Logged

LG Uwe

Wer sagt, Reichtum ist alles, hat nie ein Kind lächeln gesehen.
gottfried

Offline Offline

Posts: 981


« Reply #2 on: January 16, 2012, 03:26:14 PM »

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

Code:
//: [[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 ?
« Last Edit: January 16, 2012, 04:07:55 PM by gottfried » Logged
lumpiDumpi

Offline Offline

Posts: 2


« Reply #3 on: January 16, 2012, 04:13:32 PM »

@jacobi: quasi ein Bild (bild 1 im verzeichnis) das immer einen link (link 1) hat

@gottfried: die Richtung ist schon gut, würde das auch mit einer Textdatei funktionieren, wo ich zeile für zeile einen link reinschreibe und die bilder 01 - 0x nenne und zeile 1 ist der link für bild 01 oder für jedes bild eben nur eine Textdatei mit link ...  huh

Danke euch beiden für eure Antworten erstmal ...
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!