Linking to random images
dirt
Registered Users Posts: 2 Beginner grinner
I'm looking to find a way to link to random images on Smugmug. Want to implement a 'picture of the moment' on on my webpage, so that each page load would pull a random image from my Smugmug gallery.
Is there something in Smugmug to allow this, or has someone developed a script that would allow this?
Any help would be appricated.
Is there something in Smugmug to allow this, or has someone developed a script that would allow this?
Any help would be appricated.
0
Comments
- Login (some sort of it)
- getAlbums
- Randomly select album id
- getImages for that id
- Randomly select image id
- getImageURLs
- choose the proper size (tiny..original) and use it
That's all folks!I must only warn you that
- I personally tested only login and getAlbums
- so far there is no way to request a filtered set of albums (I have an oustanding request for that, but who knows when and if it's gonna be done), so this call will return every album you have, which may take a few seconds
Other than that, it's as simple as that..Cheers!
Thanks,
Simon.
Flickr has an incredibly simple way to display a set of random images that link to full size within the gallery at flickr. For example:
http://www.flickr.com/badge_code.gne?nsid=48600097242@N01&count=3&display=random&name=0&size=square
Doesn't smugmug have any simple API like this? I'm a web developer, but I want to spend time working on my site, not interfacing with login API calls, grabbing gallery ids and generating random numbers.
Hopefully I'm missing something and there's a simple way to do this.
Simon.
I don't believe there is any existing script, etc. to pull random images from Smugmug.
I have no idea why this happens, but every time the page is refreshed on my smug mug photo gallery, there is a new random image displaying.
www.silverspoonmurals.com/photogallery.html
It will do this unless you tell it not to in Photo Tools under the images. If you choose "Feature Photo" under the image you want, that picture will always show. Otherwise, they rotate through the gallery.
Smug since 2006
SmugMug Help
PhotoscapeDesign
-Tim
I coded up something that might help you - see http://www.dgrin.com/showthread.php?t=29854, "Hack help: Random smug thumb/url on my webpages"
The interesting news is that you don't actually need to login, so don't need an APIKey - as long as you only want public albums, you can just go straight to the album.get.
Essentially, I run a perl script to get a list of all images in all albums for a specific smugmug nickname. I use that list to generate a .js javascript file. Include that file in your webpages, and the tags <script type="text/javascript">smugPhoto();</script> will turn into random images from your account, linked to their respective galleries.
You'll need to be able to run perl scripts to get this to work, and have a few basic libraries.
Hope that helps someone...
-Tim