Gix075 / donkeyGallery

asynchronous ajax/php dynamic gallery
MIT License
12 stars 10 forks source link

DonkeyGallery Help #1

Closed infomaniaco closed 9 years ago

infomaniaco commented 10 years ago

Hello everyone, I am new here and I would like to explain to you a problem that is concerning me regarding Donkey Gallery (http....). Donkey Gallery is a set of ajax, php and css which cooperate in order to create a beautiful, fast and clean picture gallery wich can be easily inserted into websites. Donkey Gallery is a set of ajax, php and css which cooperate in order to create a beautiful, fast and clean picture gallery which is easy to insert into websites. . As you can see it will be enough to charge your own pictures into the /images cartel and open an empty class. example: (

class id="gallery-id"
) this is a html page which hosts good picture presentations by DonkeyGallery. My problem is: my database contains information for every single picture and I would like it to appear along with the picture. How can I do that? source: https://help.github.com/articles/github-flavored-markdown Donkey gallery download: https://github.com/Gix075/donkeyGallery

[IT] Salve a tutti, sono nuovo quì, e vorrei esporvi un problema che mi affligge riguardo Donkey Gallery (http://factory.brainleaf.eu/donkeyGallery/) DonkeyGallery è un insieme di ajax, php e css che cooperano per avere una galleria di immagini bella,veloce,pulita, e sopratutto facile da implementare nei propri siti web. Infatti basta caricare le proprie immagini nella cartella /images e aprire un div vuoto

esempio:(

class id="gallery-id"
)

Nella pagina in html per avere una buona presentazione delle immagini. Questo è il mio problema: ho delle informazioni contenute nel mio database per ogni immagine, e vorrei e si potessero visualizzare insieme all'immagine, come potrei farlo?

fonte:https://help.github.com/articles/github-flavored-markdown Donkey gallery download: https://github.com/Gix075/donkeyGallery

Gix075 commented 10 years ago

Hi, this is impossible to do with donkeyGallery at now. Probably in the next future I will add a new feature that allows a json data loading instead the actual folder file listing. The only thing you can do is to write a php script that calls your db and returns a json response with the data you want to add on your images, then, with some javascript code, you can append the new data on each image.

infomaniaco commented 10 years ago

thanks for your answer, I'm thinking to calls my DB and take the info modifing this function :

galleryGenerate($galleryPath,$forceGenerate,$thumbSizes,$elementId,$root) { $md5check = md5check($galleryPath,$root); $galleryImages = imageList($root.$galleryPath); $galleryNumb = count($galleryImages); for ($i=0; $i<$galleryNumb; $i++) { if (($forceGenerate == 1) or (md5check == "changed")) { thumbGenerate($galleryImages[$i],$galleryPath,$thumbSizes,$root); }
$alt = $i+1; //call DB and take info of "galleryImages[$i]" //$code['jsonInfo'][]= "IMAGES INFO HERE" $code['jsonFancy'][] = "<a href=\"".$galleryPath.$galleryImages[$i]."\"><img src=\"".$galleryPath."thumb/thumb-".$galleryImages[$i]."\" alt=\"Image ".$alt."\" />"; $code['jsonNoFancy'][] = "<img src=\"".$galleryPath."thumb/thumb-".$galleryImages[$i]."\" alt=\"Image ".$alt."\" />"; $galleryJsArray[] = " { 'href' : '".$galleryPath.$galleryImages[$i]."' } "; } return $code; }

Is that possible? or am I doing it wrong?

Gix075 commented 10 years ago

Yes i think is possible, but remember that this function is used to generate a json response for the jquery plugin, so (to obtain a new markup with new data) you need to modify the jquery.donkeyGallery.js file too .

infomaniaco commented 10 years ago

Well, so I must use a new markup for my new information from my DB or can I use that one?


PHP galleryFunction.php ==> function galleryGenerate


function galleryGenerate($galleryPath,$forceGenerate,$thumbSizes,$elementId,$root) { $md5check = md5check($galleryPath,$root); $galleryImages = imageList($root.$galleryPath); $galleryNumb = count($galleryImages); for ($i=0; $i<$galleryNumb; $i++) { if (($forceGenerate == 1) or (md5check == "changed")) { thumbGenerate($galleryImages[$i],$galleryPath,$thumbSizes,$root); }
$alt = $i+1;

                //HERE I OBTAIN THE INFO (STRING) BY USING THE NAME OF  IMAGE
       $info= infoDB($galleryImages[$i]); 
               $code['jsonInfo'][]=$info; //HERE I WANT TO PASS THIS INFO

$code['jsonFancy'][] = "<a href=\"".$galleryPath.$galleryImages[$i]."\"><img src=\"".$galleryPath."thumb/thumb-".$galleryImages[$i]."\" alt=\"Image ".$alt."\" />"; $code['jsonNoFancy'][] = "<img src=\"".$galleryPath."thumb/thumb-".$galleryImages[$i]."\" alt=\"Image ".$alt."\" />"; $galleryJsArray[] = " { 'href' : '".$galleryPath.$galleryImages[$i]."' } "; } mysqli_close($connessione); return $code; }


//this is a piece of JQUERY.DONKEYGALLERY.JS


switch (settings.fancybox.active) { case false: var count = Object.keys(data.jsonNoFancy).length; for (var i=0; i<count; i++){ markup += "

  • "+ fCssOpen + data.jsonNoFancy[i] + fCssClose +"
  • "; //markup += "
  • "+ fCssOpen + data.jsonInfo[i] + fCssClose +"
  • "; // markup += "
  • "+ fCssOpen + data.jsonNoFancy[i] + fCssClose +"
  • " +data.jsonInfo[i] ; }


    I really need help to continue with clarity, my target is to view the image with description saved in a DB with the name of the image (puoi rispondere anche in italiano)

    Gix075 commented 10 years ago

    I think for .... { markup += ""+ fCssOpen + data.jsonNoFancy[i] + data.jsonInfo[i] + fCssClose +""; }