Random image API requests
Reeves
Registered Users Posts: 17 Big grins
Howdy folks,
OneThumb pointed out in the API thread that there is random image via URL API for pulling a random image of a particular size from a given gallery (very cool, I'm going to start using that :).
I do, however, have two requests for variations on that API:
Cheers,
Reeves
OneThumb pointed out in the API thread that there is random image via URL API for pulling a random image of a particular size from a given gallery (very cool, I'm going to start using that :).
I do, however, have two requests for variations on that API:
- The first request is the same request as TazzyTazzy: be able to pull a random image from my entire site. I'd love to have a random image from my galleries featured on my blog.
- The second request is to be able to pull a random image from a keyword gallery. I have a "favorites" gallery put into my featured section (details on the hack) but the image is hard coded. I'd like to have the gallery preview thumbnail rotate like those of other galleries.
Cheers,
Reeves
0
Comments
tx to all who help here
Rich
I've try with a few different gallery IDs, all resulting in "Photo Not Found".
For example, viewing
http://www.smugmug.com/photos/random.mg?AlbumID=1340265&Size=SMUGSIZE
results in
http://williams.smugmug.com/img/imagenotfound-Tiny.gif
http://www.smugmug.com/photos/random.mg?AlbumID=1842802&Size=SMUGSIZE
results in
http://primarycolors.smugmug.com/img/imagenotfound-Tiny.gif
It's finding the right smugmug site for the gallery ID provided, but it's not finding any images...
Hey BeachBill,
I'll bet your issue is that you're not replacing "SMUGSIZE" with a valid SmugMug size (Tiny, Thumb, Small, Medium, Large, Original).
I think custom pixel render targets work, too, so you could specify "300x300" instead of a size to get a pic that's 300px on it's longest side.
Don
Oh, I didn't know that SMUGSIZE had to be replaced by anything. That was evident from the posting I took this from (http://www.dgrin.com/showpost.php?p=334753&postcount=3)
It works good now that I know what I'm doing!
Thanks!
/photos/random.mg?Keyword=lighthouse&Size=150x150
It would be really awesome if I could use that instead of having to create an album just for lighthouses to display a random lighthouse. Until then I guess I'll just have to keep doing it this way.
http://www.riphoto.com/
Please Vote - External Shopping Cart Links:
http://uservoice.com/a/mL8RD
The custom size render feature is cool, is it also possible to have a custom crop applied?
For example:
/photos/%photoid%-150x100-crop.jpg
Which would give a 150x100
I would like this feature to be able to build graphic elements dynamicly.
Doug
Chibi Photography
pix.chibiphotography.com
Anyhow, for now the way I get around this is right now is with a little PHP script. I create a file that contains a list of galleries and I grab a random gallery number from that and stick that into a dynamically generated URL. I have some extra information so I can select a specific gallery for certain pages if I want to. The file makes this easier because if something changes it's all in one place.
I think the API would let me do this on the fly, but I haven't got that far into that part of it yet.
If I get a second I'll dig it out and post it.
thanx
-jmck
Since I can't seem to get a random image selected by keyword, I was going to do exactly the same thing with the php script. That was my project for today. If you're happy with your code and are willing to share, I'd be greatful for the assist.
I just assumed random.mg had a keyword-based mode!
Haha- OK, I'm not going to be that dramatic. I could really use this simple feature.
I've got three local scools in one gallery, differentiated by keywords. I wanted to put a random.mg img tag on the website for one of the schools, but I would need a Keyword CGI parameter. C'mon guys- that would take you, what... all of 10 minutes?
Let's make that code work^^^
Consider it thrown
I am currently doing this in C# for a DotNetNuke module I'm creating. I am using Evan Leventhal's .NET wrapper. (SmugMug.NET) but I have to make multiple calls to get the albums, then the images within an album, then randomly select one of the images from that list.
I'd like to have an api call like:
smugmug.images.getRandom
Arguments:* String SessionID
- int AlbumID optional
- Boolean Heavy optional
- String Password optional
- String SitePassword optional
This could return a random image from all albums (or a selected albumID). This would be a lot less bandwith heavy than the multiple calls I am making now.Any thoughts?
Thanks
Paige Watson
Couldn't you avoid those last two steps (and avoid at least one heavy call) by just randomly selecting a gallery and then pointing the random.mg script at that gallery?
--Darryl
Yes, but I don't get the picture info (like name, description, date taken, etc). My first version has gets a users albums, then randomly selects an album and uses the random url. This is nice, but doesn't allow all the data to come with it.