Just curious if anyone is interested in a Drupal module to integrate your smugmug gallery into your site? I've started work on a drupal module which i've called smugmug.module, but I haven't quite released it. I consider it alpha code at this stage.

For that don't know, smugmug is much like flickr, but more advanced. Check it out, smugmug.com. If you decide to sign up, use my coupon code so 1) you get $5 off, 2) I get a few bucks to encourage me to develop smugmug. I'm not employed with smugmug, nor affilated in anyway other than I wanted my smugmug galleries integrated into my website. :-) Coupon code: qgSctxuKhAiAE

About the module I have so far:

  • The module uses the xmlrpc.inc file to handle XML requests/responses to/from the smugmug API system.
  • Random image block- Due to the load time of getting all image ID's from smugmug, the block selects 5 random galleries to pull random images from for that page load. At first, was getting image ID's of all albums, but this took a very long long.
  • Input filter, much like flickr.module. Simply insert {{smugmug:1111111}} where 111111 is the ID of the image you want displayed in your node/blog/page/etc. This will get you a thumbnail size. You can also use {{smugmugY:11111}} where Y is the size of the image you want, T (tini), S (small), M (medium), L (Large), O (Original). These are the smugmug API sizes. Smugmug also allows you do dynamically request the image at any size. So, Y can also be a number such as {{smugmug201:11111}} and you'll get an image that it's largest side will be 201 pixels, the other side will be scaled down to the proper ratio. Pretty sweet. This allows you to have any size image on your node/page/forum post/book/etc.
  • All API calls are cached to a local table. This significantly speeds up the webpage, and greatly lowers the load on smugmug's API system.
  • The gallery/category/subcategory integration has been implemented so far. Hopefully soon i'll get an album integrated. What I mean by this, is you can surf your smugmug gallery within your drupal site.
  • Everything is setable though admin page. Cache timeout, # of images in random block, etc.
  • From the started, i kept multi-user support in mind. That is, other users on your site can see their gallery within your drupal site. The bare parts are in, but this is not anywhere near working - this is considered alpha code at this point. I'll only complete this if there is a demand. I'm just using the module for my single user system (it's my blog site).

I've only been working this for a couple of weeks, but making pretty good progress. My motivation is that I don't have alot of storage on my ISP, and smugmug is nearly unlimited. :-) I'm new to smugmug, semi-new to drupal (since 4.3), and long time web tinkerer.

You can find more information at: http://www.dgrin.com/showthread.php?p=330491

You can see my website at: http://www.warmy.com/ Check out the gallery. :-)

I'll release the code if there any interest. I'll have to do some code clean up first and code doco. :-)

I look forward to seeing your comments, or if you found any bugs.

-Mitch

Comments

jrc’s picture

Mitch, I would have use for the smugmug module on a couple of sites. Although I like Flickr, I found smugmug to have a much better interface in cases where users might like to order prints. I was looking into using Flash/Actionscript to perform Smugmug intergration within a Drupal site, but if you have a module, you'll spare me quite a few cycles and about half a pound of coffee.

tazzytazzy’s picture

Just a status update on the drupal module.

I now have full album viewing from within the drupal module. You can view albums, or images. You can also select the image size.

Changes since last update:
* Improved API cache system. Should lower the load on the API system even more. You set a base cache timeframe, say 24 hrs. Then, you have the following cache times:
List of albums = base cache / 2 (12 hrs)
ImageURLs = base cache * 10 (240 hrs - 10 days)
ImageInfo = base cache
Subcategories = base cache * 2
Categegories = base cache
* Fixed cache reads - some reason wasn't always reading the cache. Changed cache lookup algorithm.
* Display albums within module
* Display images within module
* API errors are handle more gracefully - if API error, users are sent to smugmug.com album.
* URL for albums, images, gallery, category, and subcategory is set from module settings menu. For example: Can set the album url to warmy.com/smugmug/album/AlbumTitle or warmy.com/album/AlbumTitle
* Number of images displayed in random block setable in block control panel.

Yet todo:
* Perform full security analysis of code - mainly user variables passed in from web browser - only minimal checking
* Code clean up
* More in-code doco
* Debating how to implement "most recent" images in a block. No good API exists, most likely have to parse an RSS/Atom feed of some sort (not prefered method).

Please check out the website, open to suggestions/modifications before publishing code. http://www.warmy.com/gallery

-Mitch

tazzytazzy’s picture

I finally got the password protection scheme to work with smugmug. This took me a while as I had to learn the Drupal form API (which isn't well documented). I started a new table to keep track of passwords too.

The table tracks if the current user (or session) has attempted to login. It will block access to the album for an hour after 5 failed attempts. After a successful login, it will only store if the user has access to an album or not. Two examples:

Anon user (userid = 0):
Tracks attemps / success using session ID && albumID. On success, it marks that session as being able to view an album. Now, random images will include that album in it's selection. Also, when browsing galleries or an category, it will allow random images representing the album to show.

Logged in user (userid != 0):
Tracks attemps / success using userID && albumID. On success, it marks that USER as being able to view an album. Now, random images will include that album in it's selection. Also, when browsing galleries or an category, it will allow random images representing the album to show.

The MAJOR different between anon user and logged in user, is that once a logged in user enters the correct password, that user will never have to enter a password again! It remembers your access.

Passwords are not stored in THIS table, only if you have access or how many failed attempts.

To see this in action yourself: http://warmy.com/gallery/category/Other
Click on "test album". The password is "asdf". You can let it fail up to 5 times before that album is locked out you (or session) for an hour or so.

Smugmug does not present the album password hint, once they do, i'll update the module.

I think i'm about done. The theme (output) could look a little better. Any suggestions before I release the code?

I'm now up to about 1600 lines of code.

-Mitch

mindstorm’s picture

I was just about to start investigating something like this for my site. smugmug has rss/atom feeds, but the news aggregator doesn't parse the img links to display the pictures. I came here, did a search for smugmug and here I am. I don't know when you plan to release the module, but if you need another tester, feel free to contact me (binary10@gmail.com). Thanks for taking up the effort.

tazzytazzy’s picture

Give me another week or two too to fix a couple of bugs and work on the todo list. I also want the module to run a little bit to build a cache so that I can see if the cache is performing as expected.

tazzytazzy’s picture

I'm still tweaking the module. I've fixed various bugs since my last update.

Fixed/Updated:
* Cache system tweaked yet again. There were various bugs here. More optimizations for faster cache.
* Extended URL image cache to three months. As far as I know, these have never changed, so maybe 6 months would be better. Remember - longer cache time = faster access for your users and less API load on Smugmug. Don't want Smugmug to shut down your API key due to extreme load.
* Cron now fetches random image URLs tp store in cache. This speeds up the viewing.

Bugs:
* Allow multiple images to displayed on the same line. That is, images can only be displayed in a column. Rightly annoying if you want to display a series of small thumbs.
* Sometimes the split() call to determine the file suffix doesn't work. This function needs some tweaking.

Todo:
* More code cleanup. There's alot of debug code/lines. Also, formating needs to be polished. Minor stuff, but still...

tazzytazzy’s picture

Okay,
I'm done some tweaking.

* I've fixed the block not properly showing images. Changed the split() command to properly get file type.
* Now can have multiple images in a row without squishing the other smugmug tags.
* Started work on fetching Smugmug stats... Rough demo at: http://www.warmy.com/smugmug/stats Hopefully Smugmug fixes API to return stats on individual images, but I think the code is right - appears smugmug API method is broken.
* Changed syntax. Works much like img_assist module. Here's a portion of the README.txt file:

A full smugmug tag looks like this:

[smugmug|id=2322378|alt=Alt text to display for image.|align=right|size=thumb|link=http://www.google.com]

Argument: id
Default: No Image returned
Description: Image ID from smugmug. Surf your smugmug gallery,
then select the image want to see. The ID is at the end of the
URL.

Argument: alt
Default: Smugmug image description
Description: Alternative text to display for your image.

Argument: align
Default: left
Description: How to align the image near/within text. top, bottom, center, left, right.

Argument: size
Default: thumb
Description: Size of the image to display. list of possible
arguments. Prefered sizes from smugmug are the words, as stats
will be tracked for those requests.

Size Shortcut
---- --------
tiny ti
thumb t
small s
nedium m
large l
original o
xxxx

Where xxxx is a number such as 200. This would request an
image from smugmug where the longest side is 200, and the other
side resized to the proper ratio.

Argument: link
Default: to smugmug image within gallery
Description: Allows you to supply an alternative link for an image.

mindstorm’s picture

I like the transfer stats page. Great addition/enhancement.

Stardog’s picture

Hi, I've been looking for something like this. Has this been released as a contributed module yet?

Thanks!

tazzytazzy’s picture

Get my module posted on the Drupal modules list? :-) I can release an alpha version for testing/suggestions. The code is sloppy, but it works. :-) -Mitch

tazzytazzy’s picture

I've released 0.3 alpha of the smugmug module. You can fetch it at:
http://warmy.com/smugmug_4.7_alpha03.tar.gz

Notes: It's alpha, if it breaks your site - sorry - not responsible for anything. It's already been installed on a couple of sites now.

Can see it in action: http://www.warmy.com/gallery

Recent changes:
* If originals are disables on smugmug, a link is not displayed to original within the module. Even if someone knew the proper image url, they still couldn't see it thanks to smugmug blocking it.
* Added graphics on filmstrip view - current image on filmstrip is now highlighted.
* Fixed Session API hash information for password security

Help requested:
Input. Changes to make it better. Notably, i don't like the current way images are displayed with the filmstrip. Any suggestions?

Help me make this better by providing feed back, suggestions, etc. Thanks.

ToDo:
* once smugmug API has comments and keyword support, i plan to implement that.

- Mitch Schwenk
http://www.warmy.com/

tazzytazzy’s picture

Version 1.03B (beta) has been released.

This currently only works on version 4.7.x Drupal. It will be upgraded to work on version 5.1 soon.

New features:
* Completely new API functions. Supports SmugMug's new PHP API interface. Database backed has also been rewritten. All this by was done by Brian Foley. These two renovations have increased smugmug.module speed dramatically.
* Module now has templates, much like the drupal themes. Still a work in process but the foundation is in and working.

Todo:
* Get it working with Drupal 5.1.x
* Waiting for smugmug to implementing keywork/comment/description searches through API. We're working on a work around for this.

Download:
http://www.warmy.com/smugmug_103b.tgz

-Mitch

tazzytazzy’s picture

1.04b of Smugmug module almost released. Still won't be drupal 5.x compatible - will be in 1.05b.

However, you can still download and use the Alpha version of 1.04. As it stands, it's more stable than 1.03b, and drastically faster.

You can download the latest "working" build from:
http://www.warmy.com/smugmug-nightly.tgz

It's recommended to download the `nightly' builds. As of right now, they tend to be more stable then the last stable release. These are also only built after the module has been tested on warmy.com. The nightly built is what is currently running at:
http://www.warmy.com/gallery

You can see a change log at:
http://www.warmy.com/smugmug-change.txt

If you are using any version before 1.x, they will stop working soon as that API key will be disabled once 1.04b is released.

- Mitch Schwenk -
http://www.warmy.com/

tazzytazzy’s picture

As I posted on my website ( http://www.warmy.com/2007/drupal_smugmug_module_105b ), I finally upgraded to Drupal 5.1, which meant that I had to upgrade my smugmug module to be Drupal 5.1 compatible. Brian Foley did most the work in getting it going, I just fixed a few loose ends.

The Smugmug module for Drupal 5.1 has been freshly released (a few moments ago) as version 1.05b (beta). I've only tested it a little bit. There are many changes that need to be done for menu/config placement as well as the on-website help.

If you are currently using the module, you'll need to drop all the smugmug_* tables and import the new ones from the smugmug_databases.sql file. I don't have time to write the update scripts, and I don't even know how (yet). I'm currently packing my bags to leave for Europe next week. If you find find a bug, please let me know. I'll only address critical ones for now, and any cosmetics, I'll fix later.

The address for the nightly build remains the same:
http://www.warmy.com/smugmug-nightly.tgz as of right now, it's version 1.05b

I have some new features planned for when I return. Keep an eye on the change logs.
http://warmy.com/sm-changelog.txt

-Mitch Schwenk
http://www.warmy.com

tazzytazzy’s picture

After a lot of work and tinkering, I _finally_ have slideshows available for the drupal module for smugmug. It uses javascript, with a tag to display a single static image for browsers that don't have javascript enabled/support.

Change log: http://www.warmy.com/sm-changelog.txt
Download: http://www.warmy.com/smugmug_nightly.tgz

Also: This has been test with Drupal 5.2 at http://dev.warmy.com

Cheers!

- Mitch Schwenk

that1guy’s picture

What is the status of this project? Looking at the example, I am wondering why you can't get the flash look of the smugmug gallery with this module, or can you?

What about Drupal comments? Is it possible to just allow people with an account on your Drupal site to comment and rate photos?

tazzytazzy’s picture

I've not worked on this. For me, this module works good enough. You can download the latest version here:
http://www.warmy.com/smugmug-nightly.tgz

There's still a few little bugs here and there. You are welcome to fix them. One is the slideshow when viewed with IE. Works in firefox, but not IE. Probably something stupid and easy to fix, I just don't have the time. If you find the cure, let me know and I'll update it on my side.

As far as comments, the last time I checked (a few months ago), smugmug doesn't allow access to the comments through the API. I would like to keep the comments at smugmug...just so that people can see the comments at either location.

If you want to develop a rating system, go ahead. Send me the updates. I just don't have time right now to develop anything. The code isn't the cleanest. I kept adding new features after I got my core stuff in. I'm sure it could use a revamp.....Maybe a good time to put a rating system in. I just wanted something to integrate my smugmug module into my drupal site to make it appear the photos are on my own website.

-Mitch

pcoughlin’s picture

Do you think it might be time to turn this into a project module?

Looks like it has matured quite nicely and has some great features.

Now I will watch for any other changes.

mcurry’s picture

I've begun using the smugmug module and I'd like to submit bugfix patches.

Michael Curry - http://exodusdev.com

patbranch’s picture

Does this currently only work with 4.7?

malcriado_de’s picture

Mitch

Are your plans to make this an "official" drupal module? If yes, I could contribute with testing/bugfixing/coding. If no, would you donate your code to people willing to make it a module?

I have drupal 6.9 installed and would like to integrate my smugmug pics into my site (besides everything else that's missing up to now).

- Martin Binder

fox’s picture

Same here.

Slovak’s picture

Finally someone made this into a module... http://drupal.org/project/media_smugmug

winston’s picture

Tazzytazzy's is much more ambitious than mine. Mine is an emfield image (and video) provider. I'll be adding photoset (gallery) support shortly, but still quite a different module than this.

I may "borrow" some of tazzytazzy's code for parsing the keywords if his is GPL compatible (or with permission). Smugmug has a pretty funky and rather inconsistent way of dealing with keywords so that was on my "to do" list anyway.

The future of media_smugmug has much more to do with the future of the media module than anything else as that is the direction I would hope to take it. Media module promises a real UI for browsing external resources (instead of the current copy/paste of urls that emfield does) and greater integration of external media with drupal (external media handled much more like local files).

Anyway, stay tuned. And if there are any smugmug folks out there please test my provider module and report any bugs or problems!

Peter