We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33987 ☆ A M B ☆
    • 197 Posts
    I'm currently working on my new blog and I was looking for a Flickr plugin, which is lacking! The only thing available right now is a feed-plugin which takes a Flickr RSS feed. I want to extend the functionality.

    This is what I have in mind for the first release:

    • It will be using the Flickr API: http://www.flickr.com/services/api/
    • New MODX FlickrTV which let's you select a Flickr gallery, from your own account. This means you have to be authenticated
    • Snippet for use in your Template, which reads the FlickrTV and display a gallery based on your FlickrTV value
    • Multiple gallery display parameters: lightbox, slider, etc.

    This is what I will be using it for, but I'm pretty sure there is more to it. I'd love to hear your ideas!
      Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

      In need of a MODX consult? Try our MODX Developers Experts!
      • 33968
      • 863 Posts
      I started work on a rough snippet which does most of the above:
      https://forums.modx.com/thread/31399/anyone-here-has-phpflickr-running-inside-modx#dis-post-169936

      It was never readied for release as an extra though. Feel free to use and modify as you wish.
        • 33987 ☆ A M B ☆
        • 197 Posts
        Thanks Lucas. I'll abuse your code and will credit you of course laugh
          Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

          In need of a MODX consult? Try our MODX Developers Experts!
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Media source? smiley
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 33987 ☆ A M B ☆
            • 197 Posts
            That would be nice too. But that's something for Kevin...

            This is more like a flickr-gallery-embedder-thingy.
              Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

              In need of a MODX consult? Try our MODX Developers Experts!
              • 38290
              • 712 Posts
              Might make sense to use getCache to allow you to cache the snippet that hits the API and give it a cacheTime of something like 10 minutes.
                jpdevries
                • 42049 ☆ A M B ☆
                • 250 Posts
                I'm pretty sure I've covered all that you're trying to do already with a site I made here...

                http://www.visualexcellence.co.uk/gallerys.html

                Fetchs galleries via xml/rss and renders it all with jquery. Check out the network tab to see whats going on.

                Of course there is the realms of caching to look into for a more robust solution. But most of the leg work is done for you.

                EDIT : Posted below [ed. note: gelstudios last edited this post 13 years, 10 months ago.]
                  GEL STUDIOS
                  MODX Professional | MODX Ambassador

                  Website | Email | Twitter | Facebook
                  • 42049 ☆ A M B ☆
                  • 250 Posts
                  Here you go, snippet properties are

                  $photoLimit = How many photos should be called
                  $showTitles = Shall we show titles? 0 (false) 1 (true)
                  $album(x) = Unique Album ID

                  <?php
                  //Declare our vars
                  $namespace = "http://search.yahoo.com/mrss/"; 
                  $ourItems = "";
                  $ourFeeds = array();
                  
                  foreach ($scriptProperties as $album) { //Lets add an entry into ourFeeds array for each valid album
                  
                      if (strlen($album) > 10) { //Lets just check we are dealing with a valid album id
                          //$ourFeeds[$album] = "http://api.flickr.com/services/feeds/photoset.gne?set=".$album."&nsid=50910794@N07&lang=en-us&format=rss_200";
                          $ourFeeds[$album] = $album;
                      }
                  }
                  
                  foreach($ourFeeds as $aFeed) {
                  
                      //Lets now build the URL for the feed and work out how many images the user wants to pull
                      $feedID = substr($aFeed, 0, 17);
                      $feedURL = "http://api.flickr.com/services/feeds/photoset.gne?set=".$feedID."&nsid=50910794@N07&lang=en-us&format=rss_200";
                      $photoLimit = substr($aFeed, 18);
                  
                      if ($photoLimit == null) { //If no limit was set, we will take the default photosToReturn value and use that as our limit
                         $photoLimit = $photosToReturn;
                      }
                  
                      //Fetch the feeds details as raw code, and turn it into an XML document
                      $content = file_get_contents($feedURL);
                      $rawFeed = new SimpleXmlElement($content);
                  
                      $albumTitle = $rawFeed->channel->title; //Grab the album title
                      
                      $thisPhoto = 1; //PhotoCounter
                  
                      //Lets now loop through all the items grabbing what we need, and adding to our LI var
                      foreach($rawFeed->channel->item as $entry) {
                          if ($thisPhoto <= $photoLimit) {
                  
                              $thumbParent   = $entry->children($namespace);
                              $thumb         = $thumbParent->thumbnail->attributes();
                              $image         = $thumbParent->content->attributes();
                  
                              $attr = array(
                                 "aT" => $albumTitle, //Album Title
                                 "tW" => $thumb['width'], "tH" => $thumb['height'], "tU" => $thumb['url'], //Thumbnail Attributes
                                 "iW" => $image['width'], "iH" => $image['height'], "iU" => $image['url']);  //Image Attributes
                  
                              if ($showTitles == 1) { //Are we showing titles?
                                 $attr["pT"] = $entry->title;
                              }
                  
                              //Going to make an assumption there that all of the files ever returned are jpgs...
                              $attr["tU"] = substr($attr["tU"], 0, -5);
                              $attr["tU"] .= "q.jpg";
                  
                              $ourItems .= "<div class='fpPhoto'><img src='" . $attr["tU"] . "' /></div>";
                  
                              $thisPhoto++; //Added now onto the next photo
                          }
                      }
                  }
                  
                  //Add all the LI's into the UL
                  return $ourItems;
                    GEL STUDIOS
                    MODX Professional | MODX Ambassador

                    Website | Email | Twitter | Facebook
                    • 33987 ☆ A M B ☆
                    • 197 Posts
                    Awesome!!! I'll look into it tomorrow smiley
                      Sterc Internet & Marketing | MODX Founding Partner | Chairman of the MODX Advisory Board

                      In need of a MODX consult? Try our MODX Developers Experts!
                      • 42049 ☆ A M B ☆
                      • 250 Posts
                      Let me know how you get on, maybe we could collaborate on a joint release smiley
                        GEL STUDIOS
                        MODX Professional | MODX Ambassador

                        Website | Email | Twitter | Facebook