OK
You have to :
Have a working gallery2 installed.
Have a working galler2 module installed.
First i think you must edit the plugin (because i wasn’t directly logged in the and that was causing trouble with the random image snippet):
-Modify the Gallery Plugin : tick the system event "OnWebLogin". In "General", above the "OnWebLogout" case , add :
case "OnWebLogin":
$uid = $modx->getLoginUserID();
if ($uid) {
// check is id map already exists
if(GalleryEmbed::isExternalIdMapped($uid,'GalleryUser')==GalleryStatus::success()) {
GalleryEmbed::checkActiveUser($uid);
}
else {
$user = GalleryCoreApi::fetchUserByUserName($uid);
if ($user[1]->_id>0) {
// add id map
$ret = GalleryEmbed::addExternalIdMapEntry($uid, $user[1]->_id, 'GalleryUser');
GalleryEmbed::checkActiveUser($uid);
}
}
}
break;
Then replace :
// include Gallery API
require_once($g2base->g2Path.'/embed.php');
$ret = GalleryEmbed::init(array(
'embedUri' => $g2base->embedUri,
'embedPath' => $g2base->embedPath,
'relativeG2Path' => $g2base->g2RelativePath
));
By : (we add the line ’activeUserId’ => $modx->getLoginUserID())
// include Gallery API
require_once($g2base->g2Path.'/embed.php');
$ret = GalleryEmbed::init(array(
'embedUri' => $g2base->embedUri,
'embedPath' => $g2base->embedPath,
'relativeG2Path' => $g2base->g2RelativePath
'activeUserId' => $modx->getLoginUserID()
));
If think these modifications are mandatory, because apparently the random image block needs the user to be logged to be displayed. if anyone has a better way to do it, i’ll be glad to have it
(try without modification if your albums are public
)
-Create a new snippet (empty for the moment), called RandomImage (for example)
-Go to Modules / Manage modules
-Edit the Gallery module
-In "Dependencies", click on "Manage Dependencies"
-Add in the dependencies the snippet we just created
-Close and go back to the snippets
-Paste the code of the snippet (attached below)
- In the properties of the snippet, choose Gallery in the "Import module shared parameters" list
- Save, and call the snippet anywhere on a document : [!RandomImage!]
- Images are in a div: <div class="one-image">
- Titles are h4 : <h4 class="giDescription">
That’s it
By the way, you can try it without modification of the module, it might be rights issues on my gallery configuration
haven’t check it yet...
And for FURs, sorry, i think i can’t help, i have FURs disabled... bu try to look at the G2 site, they discuss issues about that.
Let me kown if it worked for you (actually it did for me
)