Options

Linking to random images

dirtdirt 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.

Comments

  • Options
    NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited December 9, 2004
    Sure thing, buddy
    1. Login (some sort of it)
    2. getAlbums
    3. Randomly select album id
    4. getImages for that id
    5. Randomly select image id
    6. getImageURLs
    7. 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!1drink.gif
    "May the f/stop be with you!"
  • Options
    walliscawallisca Registered Users Posts: 2 Beginner grinner
    edited July 5, 2005
    I don't quite understand Nikolai. Those seven steps you mention, are they existing scripts? Where do I get them?

    Thanks,
    Simon.
  • Options
    walliscawallisca Registered Users Posts: 2 Beginner grinner
    edited July 5, 2005
    Flickr has a nice, simple API for displaying random images
    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.
  • Options
    flyingpylonflyingpylon Registered Users Posts: 260 Major grins
    edited July 6, 2005
    No offense to Smugmug, I think their mission is a little different than Flickr's. But from what I've seen, Flickr has a more robust API.

    I don't believe there is any existing script, etc. to pull random images from Smugmug.
  • Options
    Silverspoon MuralsSilverspoon Murals Registered Users Posts: 6 Beginner grinner
    edited July 14, 2005
    Random display image
    I have no idea why this happens, but every time the page is refreshed on my smug mug headscratch.gif photo gallery, there is a new random image displaying.

    www.silverspoonmurals.com/photogallery.html
    dirt wrote:
    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.
  • Options
    BarbBarb Administrators Posts: 3,352 SmugMug Employee
    edited July 14, 2005
    I have no idea why this happens, but every time the page is refreshed on my smug mug headscratch.gif photo gallery, there is a new random image displaying.

    www.silverspoonmurals.com/photogallery.html
    Teresa,

    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.
    Barb
    Smug since 2006
    SmugMug Help
    PhotoscapeDesign
  • Options
    Silverspoon MuralsSilverspoon Murals Registered Users Posts: 6 Beginner grinner
    edited July 15, 2005
    DOH, yeah I just realized that since I was redoing some things in my photo gallery. Here's an idea! How about allowing certain photos to be invisible in the gallery? I just created some icons for each of my galleries. But when I get to the gallery I have to see them there also, which isn't really appropriate. Just a hint for future implementations.
    Teresa,

    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.
  • Options
    tcurtintcurtin Registered Users Posts: 5 Big grins
    edited March 13, 2006
    I'm looking to do the same thing for a website on a server running linux. Did you ever come up with a solution to this?

    -Tim
  • Options
    tcurtintcurtin Registered Users Posts: 5 Big grins
    edited March 14, 2006
    Solution in perl/javascript
    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
Sign In or Register to comment.