PHP Uploader for SmugMug

EDIT (9/28/2009): I pulled the sourcecode out of the post as it was far too long. I have also updated the download package with a couple of important fixes.

I just recently started playing with SmugMug and am really liking it so far. One of my complaints so far is the upload process. Let me be clear here…they have many upload options and odds are good that those options work for the majority of people. But I’m not one of them. Basically I want to be able to keep my online galleries in sync with the photos on my computer and I didn’t see an easy way to do this with the available options. Fortunately, SmugMug provides a solid API and many people have written tools that make use of it. I looked through what people have already written and unsurprisingly didn’t find one that did exactly what I wanted. I did find phpSmug which is a PHP class that makes using the api extremely simple.

Over the course of two days, I have written 2 separate (but related) uploaders that handle the things I need them to. Both require an API key and a valid SmugMug account. These aren’t necessarily the prettiest code I have ever written, but I think they work pretty well.

Download full (UPDATED) package

upload.php

This one is a fairly simple uploader. You give it the name of an album and a list of pictures to upload and it will upload any files that don’t already exist, replace files that do exist and update the metadata for those files.

multi-album-upload.php

This is the one that will keep a filesystem in sync with SmugMug. Point it at a folder and it will create categories, albums and handle the uploading (in the same way as upload.php).

cat-delete.php

This is a quick way to delete categories. Mostly I made it for while I was testing, but as there doesn’t seem to be a way to delete categories through the SmugMug UI this may be useful to someone.

Standard disclaimers apply to all of this. If it somehow causes the world to end or any other undesired effect, I take no responsibility. That said, it works pretty well for me. If you find any problems, let me know and I will update what I have posted.

Download full package

About

Application Developer at the University of Iowa. Works mostly with PHP/Oracle, but doesn't like the Oracle bits. Also an avid gamer and tinkerer.

Posted in Hosting, Web Development Tagged with: , , ,
3 comments on “PHP Uploader for SmugMug
  1. Hey Brian. It looks like great stuff, but we do see one problem from our end: you’re attempting to upload to the wrong host. It should be upload.smugmug.com. Please shoot us an email (help at smugmug dot com) if you need more details.

    Also, you can delete categories in our UI, but we obviously haven’t made it clear enough how to. Check the customize tab of your Control Panel.

    -Mark MacAskill
    SmugMug Support Hero

    • Brian says:

      Mark

      Thanks for the heads up on the upload host. I had originally reported that as an issue to the developer of phpSmug, but when both urls worked the same we assumed it wasn’t an issue. I have updated my package with the correct update host and have been told that phpSmug is planning a new release in the next couple of days.

      Also, I did find the category deletion tool. When I was first looking, it wasn’t apparent and it was really easy for me to put together the tool using the API. It actually probably worked out better for me as while I was testing it was quicker to use a command line tool than the website.

  2. New Year’s Heyday is observed on January 1, the to begin era of the year on the contemporary Gregorian schedule as well as the Julian calendar tolerant of in elderly Rome. With most countries using the Gregorian calendar as their main chronicle, New Year’s Day is the closest preoccupation to being the men’s at worst genuinely extensive public fete, often eminent with fireworks at the slam of midnight as the experimental year starts. January 1 on the Julian calendar currently corresponds to January 14 on the Gregorian calendar, and it is on that old that followers of some of the Eastern Prevalent churches celebrate the Restored Year.

    Sim vip Beeline | Gia Re

2 Pings/Trackbacks for "PHP Uploader for SmugMug"
  1. […] do the synchronization, I’m using the php uploader found here. It seems to be working, although I had some trouble at first pointing it at the right directory on […]

  2. […] A while back I created a set of scripts to upload files to SmugMug using php. I have recently rewritten that uploader and made it available on BitBucket. It should work almost exactly the same but it is generally better organized. Scriptingphp, scripting, smugmug ← Pull info from Pithos for Conky /* */ […]