We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19087
    • 1 Posts
    I have been a Gallery user for several years now as a modules for two other CMS and as a standalone app. It has to be one of the longest of tooth gallery applications and is certainly very mature and well maintained.

    I do run my web site on a rather ancient machine however and I have found that v2.X is just too hungry for my gear. Since a new server is not in the immediate future I have moved to lighter code in the form of Plogger and am now looking closely at MaxiGallery.

    I some regards I am sad to move away from Gallery. I have found it to be one of the best, most capable and feature rich image galleries out there. For those with reasonable hardware I would recommend a test drive.
      • 26104
      • 36 Posts
      Anyone still working on migrating the module to latest gallery version?
        • 21475
        • 80 Posts
        Hi all,

        Does anyone know how to hack the Gallery plugin : i just want to be logged into Gallery at the same time I log into MODx with the WebLogin snippet (OnWebLogin system event), as in the smf module.
        I tryed to tick the event OnWebLogin, and i add this to the plugin, above the OnWebLogout case :
        	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;
        


        (a copy/paste of some of the snippet lines...)
        Any chance for it to work? Any idea?

        By the way, i made a working Image Block snippet (working if you are logged to the gallery wink) to put a randow photo, random album or anything else anywhere on a document. If anyone is interested in, i can post it somewhere smiley

        Thanks for your replies!

        PS: Sorry for my bad english rolleyes
          • 21475
          • 80 Posts
          Hi,

          My issue seems to be resolve.
          If someone is interested in (or if some can improve the way i did it! wink) :

          I added to "include Gallery API" the following line (in the plugin code), plus the above modifications (precedent post), and it seems to work smiley
          ’activeUserId’ => $modx->getLoginUserID()
          so it looks like that :
          // 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()
          ));
          


          Now i’m directly logged into gallery, and i have a random image showing correctly.

          If someone has a better way to make it, i’m really interested smiley

          Thx...
            • 8363
            • 28 Posts
            Quote from: nicpan at Aug 11, 2006, 02:53 PM

            By the way, i made a working Image Block snippet (working if you are logged to the gallery wink) to put a randow photo, random album or anything else anywhere on a document. If anyone is interested in, i can post it somewhere smiley

            I am definitely interested in using the image block. Let me know when/if you decide to post it!
              • 21475
              • 80 Posts
              I don’t know where to post it!
              Any advice?
                • 10190
                • 187 Posts
                Quote from: nicpan at Aug 16, 2006, 07:17 AM

                I don’t know where to post it!
                Any advice?

                As an attachement to your post here? Choose "Additional Options" below the text field and attache your code.

                BTW, great work with the random image plugin - is it possible to have an random image somewhere on a page without being logged in? Menalto Gallery uses it that way normally.

                You could do all of us a great favour if you could hack the gallery2 plugin to work with friendly-URLs - on a production site this is necessary, i.e. for search engine optimization.

                Or is someone else working on that topic? Seems that nobody of the modx-coders finds the time - all working on the 1.0 release? smiley

                Frisco
                  • 21475
                  • 80 Posts
                  OK smiley

                  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 laugh (try without modification if your albums are public huh)

                  -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 smiley

                  By the way, you can try it without modification of the module, it might be rights issues on my gallery configuration smiley 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 wink)
                    • 10190
                    • 187 Posts
                    Could anyone of you G2-powerusers kindly have at look at
                    http://modxcms.com/forums/index.php/topic,8018.0.html

                    I’m having charset problems with G2 at the userside, which only show up with the modx-module.

                    Maybe the modx module sends some php-headers or s.th. which prevent german "umlaute" and such special chars from being displayes correctly? Just a guess, ’cause I’ve tried everything else (that came to my mind, but maybe I missed s.th. important wink ).

                    Any help is greatly appreciated!

                    Andre
                      • 10190
                      • 187 Posts
                      I’ve solved it, I misunderstood modx’ charset settings in the administration panel, see the link above for further explanations.

                      Kind regards,
                      Frisco