Options

Image key and id

jemostromjemostrom Registered Users Posts: 136 Major grins
Many years ago I wrote some code (wordpress plugin) to be able to get different sizes of an image so I could use it in a "lightbox effect". The idea was that I would get the key/id to an image and fetch the proper size for the theme (configured in the plugin) and the large image. I don't remember exactly how it looked but using something like
[smug key="bla" id="id" caption="blipp]

the plugin would generate something like this
<a href="large image url"><img src="small image url" /></a>

(it was a bit more complicated with formatting of captions, alignments, gallery etc).

I would like to do something similar again but this time obey all the rules :D . So, I can see that I should use the API and get the proper URL using smugmug.images.getURLs instead of creating them myself. But how do I get the ID/Key? It doesn't look like I can get them from the image URL (in the share panel) anymore.

Or does someone have a better way of solving the whole problem? (much preferred :D )
Jan Erik Moström

Comments

  • Options
    gabbiegabbie Registered Users Posts: 66 Many Grins
    edited November 14, 2014
    Hi Jan!

    If you have the URL of an image, it's easy to extract the ImageKey. Looking at the URL you'll see something like "/i-XXXXXXX" at the end. Those x's are the ImageKey. Unfortunately, version 1.3.0 of the API, there is not an easy way to get the ImageID with just a URL. You can get the ImageID by calling smugmug.images.get on the album that contains the image and extract the information you're looking for from there. It's a bit of a roundabout approach.

    We have a newer version of the API (2.0) in beta testing right now that would make some of what you're trying to do easier. If you're interested in learning more about that, send us an email at api@smugmug.com and I can explain more of the specifics.
    gabbie
    SmugMug Product Manager
Sign In or Register to comment.