Feature request: "orignalGalleryURL" for smugmug.images.get

jfriendjfriend Registered Users Posts: 8,097 Major grins
When using collected galleries and listing images via the API (smugmug.images.get), there is sometimes a desire to know the gallery where the original of each image is located. For example, when using a virtual gallery with a slideshow, some people want a click on the image to go to the "original" gallery for the image, not to the virtual gallery.

Is the "original gallery" for an image in a virtual gallery available anywhere in the API. If not, please note this as a feature request.
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 4, 2011
    Adding Origin to the Extras parameter, you will get an Album object for the origin as well as a User object, if the original is owned by a different user...

    Also, adding Type to the Extras parameter returns Collected, Smart or Album to indicate the type of image object.

    eg.
    {
      "stat": "ok",
      "method": "smugmug.images.get",
      "Album": {
        "id": 16894498,
        "Key": "DzjdsT",
        "ImageCount": 2,
        "Images": [
          {
            "id": 393386206,
            "Key": "Hqhfr",
            "Album": {
              "id": 6232467,
              "Key": "UXEGg",
              "URL": "http://www.introversion.com.au/Landscapes/Upper-Antelope-Canyon/6232467_UXEGg#393386206_Hqhfr"
            },
            "Type": "Collected",
            "User": {
              "DisplayName": "Introversion Photography",
              "NickName": "introversion",
              "URL": "http://www.introversion.com.au"
            }
          },
          {
            "id": 1276938881,
            "Key": "653ZRgs",
            "Type": "Album"
          }
        ],
        "URL": "http://devbobo.smugmug.com/Blahblahblah123/Gallery/16894498_DzjdsT"
      }
    }
    
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 4, 2011
    devbobo wrote: »
    Adding Origin to the Extras parameter, you will get an Album object for the origin as well as a User object, if the original is owned by a different user...

    Also, adding Type to the Extras parameter returns Collected, Smart or Album to indicate the type of image object.
    Cool, I'll try that. I did try to look in your online doc, but apparently didn't discover where to look.

    Is there any doc for what can go in Extras?
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 4, 2011
    jfriend wrote: »
    Cool, I'll try that. I did try to look in your online doc, but apparently didn't discover where to look.

    Is there any doc for what can go in Extras?
    Also, is there any extra cost (in transaction time) to including the Extras=Origin parameter? I'm trying to figure out if I should write the extra code to only include it when the user has passed a parameter that would make it so I would need it.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 4, 2011
    It's difficult to document the Extras parameter in the current manner in which the documentation is autogenerated. I'm working on resolving that for the next API version.

    As for the performance, it would depend on how many different sources (ie. albums and users) that the images originated from. I can see some additional optimisations that I can add, which would result in very little overhead at all.
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 4, 2011
    devbobo wrote: »
    It's difficult to document the Extras parameter in the current manner in which the documentation is autogenerated. I'm working on resolving that for the next API version.

    As for the performance, it would depend on how many different sources (ie. albums and users) that the images originated from. I can see some additional optimisations that I can add, which would result in very little overhead at all.
    I noticed one other place where I might have to manually construct an URL and that's to the Lightbox in the original gallery. There is a LightboxURL for the gallery that you're listing images in, but not for the original gallery. This is not a big deal to me, but thought I'd mention it for completeness.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited May 4, 2011
    that one is a bit tricky since the LightboxURL is currently only a property of an image... not an album.

    I'll have a think about how we can could that.
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 4, 2011
    devbobo wrote: »
    that one is a bit tricky since the LightboxURL is currently only a property of an image... not an album.

    I'll have a think about how we can could that.
    The original URL you're giving me now is to the specific image in the original gallery (has the has on the end that takes you to the correct image). The lightbox URL would just be a modified version of that same URL.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 8, 2011
    devbobo wrote: »
    Adding Origin to the Extras parameter, you will get an Album object for the origin as well as a User object, if the original is owned by a different user...

    Also, adding Type to the Extras parameter returns Collected, Smart or Album to indicate the type of image object.

    eg.
    {
      "stat": "ok",
      "method": "smugmug.images.get",
      "Album": {
        "id": 16894498,
        "Key": "DzjdsT",
        "ImageCount": 2,
        "Images": [
          {
            "id": 393386206,
            "Key": "Hqhfr",
            "Album": {
              "id": 6232467,
              "Key": "UXEGg",
              "URL": "http://www.introversion.com.au/Landscapes/Upper-Antelope-Canyon/6232467_UXEGg#393386206_Hqhfr"
            },
            "Type": "Collected",
            "User": {
              "DisplayName": "Introversion Photography",
              "NickName": "introversion",
              "URL": "http://www.introversion.com.au"
            }
          },
          {
            "id": 1276938881,
            "Key": "653ZRgs",
            "Type": "Album"
          }
        ],
        "URL": "http://devbobo.smugmug.com/Blahblahblah123/Gallery/16894498_DzjdsT"
      }
    }
    
    Interesting. Great info. This might come in handy if I have to completely redesign my random picture/video module.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 10, 2011
    Besides using the API and the origins parameter, is there any other way to figure out the source gallery of an image that you only have the imageid and key?
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 10, 2011
    SamirD wrote: »
    Besides using the API and the origins parameter, is there any other way to figure out the source gallery of an image that you only have the imageid and key?
    I think the Smugmug system is designed specifically so that there's no way to go from an image ID/key to a gallery URL. If the gallery was public, it would be possible to search (using the API) through all public galleries for the particular image. If the gallery was not public, that search would not be possible without logging in to the account.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 10, 2011
    That's what I thought, but I asked just in case I missed something. Time to manually hunt through galleries. :(
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 10, 2011
    SamirD wrote: »
    That's what I thought, but I asked just in case I missed something. Time to manually hunt through galleries. :(
    If it's in a public gallery, a script using the API could catalog or search all the imageIDs/imageKeys in the public galleries and then you could just query for the imageID you want. You'd list all galleries in the site, then one-by-one list all the images in each gallery looking for a match.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 10, 2011
    jfriend wrote: »
    If it's in a public gallery, a script using the API could catalog or search all the imageIDs/imageKeys in the public galleries and then you could just query for the imageID you want. You'd list all galleries in the site, then one-by-one list all the images in each gallery looking for a match.
    Unfortunately, it's unlisted. And I've actually got a list of galleries, but since it's only about a dozen images, it would probably take me less time to manually search since I have an idea where they are versus trying to code something. Debugging the code would probably take me 2x as long as a manual search. rolleyes1.gif

    Thank you for the tip though. thumb.gif I'm sure it will come in handy on some other image searching project.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 10, 2011
    SamirD wrote: »
    Unfortunately, it's unlisted. And I've actually got a list of galleries, but since it's only about a dozen images, it would probably take me less time to manually search since I have an idea where they are versus trying to code something. Debugging the code would probably take me 2x as long as a manual search. rolleyes1.gif

    Thank you for the tip though. thumb.gif I'm sure it will come in handy on some other image searching project.
    Unlisted galleries could be searched via the API by logging in, but if it's a contained search, then I could see how a manual search might be quickest.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 10, 2011
    If there was a way for me to have a console-like access to the api, then I wouldn't be fumbling with programming and it might be worth the time. Hmmm...didn't someone make an application like this? headscratch.gif
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 10, 2011
    SamirD wrote: »
    If there was a way for me to have a console-like access to the api, then I wouldn't be fumbling with programming and it might be worth the time. Hmmm...didn't someone make an application like this? headscratch.gif
    Not sure what you're asking for, but you can just put an API url into the browser and see the results in the browser. It's even easier now because if you're operating on public galleries, you don't even have to get a session first.

    For example, this URL (using my APIKey) gets me a list of images in a particular gallery:

    http://api.smugmug.com/services/api/json/1.3.0/?method=smugmug.images.get&APIKey=m3fjH1x4QjX6N10RsaVUeWr0dgg2oQoZ&AlbumID=5608779&AlbumKey=ZJ27n
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited May 10, 2011
    Because mine are unlisted, I have to do the session and login stuff first. Then I just have to watch for my malformed API calls.

    I was thinking something along the lines of you login like on a putty session. You tell is smugmug.images.get with the parameters like switches and it runs it in real-time. I thought someone had made an application like this, but I don't remember anymore. headscratch.gif I thought I tried it once.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
Sign In or Register to comment.