Thumbnail image for category, sub-category and gallery?

jfriendjfriend Registered Users Posts: 8,097 Major grins
edited November 10, 2011 in SmugMug API Support & Integrations
Is there any way using the API to get the thumbnail image for a category, sub-category and gallery?
--John
HomepagePopular
JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
Always include a link to your site when posting a question

Comments

  • MSkaffariMSkaffari Registered Users Posts: 147 Major grins
    edited May 25, 2011
    Unfortunately at the moment we don't have calls to get the thumbnails directly with one call. You would have to retrieve random thumbnail from a gallery to display. You won't be able to find out which image the user has set as featured image. Currently on the site the category and sub-category thumbnails come from the first gallery within.

    How would you like to retrieve this information? One call to get all thumbnail data for all categories/sub-cats/galleries or on per container basis?
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 25, 2011
    MSkaffari wrote: »
    Unfortunately at the moment we don't have calls to get the thumbnails directly with one call. You would have to retrieve random thumbnail from a gallery to display. You won't be able to find out which image the user has set as featured image. Currently on the site the category and sub-category thumbnails come from the first gallery within.

    How would you like to retrieve this information? One call to get all thumbnail data for all categories/sub-cats/galleries or on per container basis?
    I'm using smugmug.albums.get to retrieve all galleries/categories/sub-categories to display a global site map and was hoping to use a small image next to each gallery in the list (I'd probably scale down the 100x100 to 25x25 or something like that). For my particular use, I'd like to see an Extras=Thumbnail option that would get me the small thumbnail image URL for every object returned in smugmug.albums.get. I already discovered (by trial and error because it's not documented) that Extras=URL will get me the URL for everything returned in smugmug.albums.get which is really useful for my needs. Since asking about the API, it would be useful to others if all possible values for Extras (for all the API calls) were documented.

    The featured thumbnail seems like a piece of data that should also be in smugmug.albums.getInfo (since it's metadata about the gallery) and smugmug.categories.get and smugmug.subcategories.get (since it's data about those too), but if it was only in those last three functions it would be extremely inefficient for me to fetch it that way for my use because I'd have to make one API call for every single gallery/category/sub-category on a user's site which would take a long time and not be very efficient for Smugmug either.

    A work-around could be built using the random thumbnail I guess, but retrieving a random thumbnail doesn't perform very well because it's two roundtrips (and some of your server time) for every single image call (one to request the random image and the second to re-fetch the image redirect that it returns) so it's pretty easy to see how slow random images fill in. For that reason, I try to always feature a photo in my galleries so the category pages don't seem slow to show images. I'd like to avoid that same slowness issue on my sitemap page.

    And, of course, the random thumbnail URL doesn't return the featured photo thumbnail when that has been specified. And, it returns an empty gallery thumb for password protected galleries (even when an image is featured) which is certainly not desirable.
    --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 26, 2011
    John,

    Why are you using smugmug.albums.get to build a site map ? It seems that using smugmug.users.getTree would be more efficient for that task, since cat/subcat information isn't duplicated for every album like it is with smugmug.albums.get and you don't have to manually construct the hierarchy.

    Using smugmug.users.getTree, you could that randomly select a highlight image from one of the galleries contained within a category or subcategory.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 26, 2011
    devbobo wrote: »
    John,

    Why are you using smugmug.albums.get to build a site map ? It seems that using smugmug.users.getTree would be more efficient for that task, since cat/subcat information isn't duplicated for every album like it is with smugmug.albums.get and you don't have to manually construct the hierarchy.

    Using smugmug.users.getTree, you could that randomly select a highlight image from one of the galleries contained within a category or subcategory.

    Cheers,

    David
    I had already written the code for smugmug.albums.get (including several sort options) when I discovered smugmug.users.getTree several days later. It's odd to me that these are in different places in the documentation since they operate on the same scope and do mostly the same thing. Once I found albums.get, it didn't dawn on me that there would be another way to do the same thing so I didn't look further.

    I'll experiment with random images, but that isn't really my preference and it doesn't work for password protected galleries (even when a thumb has been featured).
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • spacegraym3spacegraym3 Registered Users Posts: 6 Beginner grinner
    edited November 10, 2011
    If there has to be a second call, having a call returning all feature image / thumbnail URL for each album would be beneficial. Especially if the user has a large amount of albums.

    An alternative would be to have the featured photo always by calling the album's URL with an additional parameter of featureImage=true which would return the feature image instead?

    Kind of a hack but it would be nice to get details on the feature image on the smugmug.albums.get call.
Sign In or Register to comment.