Projects
smugmugRSS Plug-in
Download (v1.1)
This plugin allows you to display images hosted on Smugmug on your WordPress site. It uses the built-in MagpieRSS that comes with WordPress to parse the RSS feed and display the images. This is my first attempt at a WordPress plugin, and while I am a developer by trade, I am admittedly not a PHP expert, you’ve been warned!
Installation
- Put smugmugRSS.php in your plugins directory
- Activate the plugin
- Configure your settings via the Options panel
How to Use (in templates, pages or posts)
- Add
<?php get_smugmugRSS(); ?>somewhere in your templates if you want the default values available in Options - Add the code with full parameters
<?php get_smugmugRSS(rss_url, num_items, display, before_block, after_block, before_image, after_image, before_caption, after_caption); ?>if you’re a control freak.
FAQ
- What feeds are supported?
This plug-in only supports RSS feeds. Smugmug offers both ATOM or RSS. Use rss200 in the format parameter.
For a full set of Smugmug Feeds, visit Smugmug’s Wiki page. I have tested this with Recent Galleries, Gallery, Keyword, Popular Photos. and Recent Photos. - How do I specify image size?
Smugmug allows for a Size parameter. Use any Smugmug supported Image Size: thumbnail, tiny, small, medium, large, original, or any of the shortcuts. It will even support custom image sizes, i.e., 100×100. - Can I use this within my posts? or do I have to modify templates?
Using another plugin like runPHP or PHPExec, you should be able to use this within your posts and templates. Here is my blog showing some exampes of the plug-in use. Blog showing use of smugmugRSS within a post.
Advanced
The plugin also supports a number of parameters, allowing you to have multiple instances across your site.
- rss_url – Feed URL
- num_items – Number of Images to display. Use 0 to display ALL
- display – tells the plug-in to display: image only (0), caption only (1) or both (2)
- before_block – this is the HTML to apply before the whole block, normally used for sidebar (titles) and opening <ul> tag
- after_block – this is the HTML to apply after the whole block, normally the closing </ul> tag
- before_image – this is the HTML to apply before the image, i.e., <li> tags or <div> tags
- after_image – this is the HTML to apply after the image, i.e., </li> tags or </div> tags
- before_caption – this is the HTML to apply before the caption, i.e., <span> tags or <div> tags
- after_caption – this is the HTML to apply after the caption, i.e., </span> tags or </div> tags
Example 1
<?php get_smugmugRSS('http://mnmdl.smugmug.com/hack/feed.mg?Type=nickname&Data=mnmdl&format=rss200&Size=100x100', 10, 1); ?>
This would show the 10 most recently modified galleries, displaying captions only.
Example 2
<?php get_smugmugRSS('http://mnmdl.smugmug.com/hack/feed.mg?Type=userkeyword&NickName=mnmdl&Data=featured&format=rss200&Size=100x100', 0, 2, '', '', '<div style="width:150px;height:200px;overflow:auto;float:left;text-align:center;">', '', '<p>','</p></div>'); ?>
This would show ALL photos tagged with keyword: "featured", displaying both images and captions with the provided HTML formatting/layout tags.
Example 3
<?php get_smugmugRSS('http://mnmdl.smugmug.com/hack/feed.mg?Type=gallery&Data=2384562&format=rss200&Size=100x100', 3, 0); ?>
This would show 3 photos from a certain gallery with AlbumID: 2384562, displaying captions only
Feedback and Support
This plug-in is not officially supported. If you have any questions or issues, try and reach me through http://dgrin.com, username: MnM
Plugin History
Latest Release: February 9, 2007
- 1.1 – Added images and captions display, and flexible formatting tags
- 1.0 – Initial release
Hello,
Is it possible to get a random image from a smugmug gallery? I’m trying to use your plugin for a ‘photo-of-the-day’.
Thanks,
Will
if you just want a random image for a particular gallery – you just need a standard IMG tag using /photos/random.mg?AlbumID=[Album ID]&Size=Tiny&AlbumKey=[Album Key]&rand=[some unique#]
I use this on my header – if you notice, they’re random images pulled from galleries. They change everytime the page is refreshed.