Photo import tool

I put this in the (new for this post) Technical category, and installed Ultimate Category Excluder to exclude it from the home page because I don’t think most people are that interested. So if you’re reading this, you probably searched for it (or used the RSS feed?)

Until recently I had been uploading photos to the site using the Media upload page, entering a URL to one of the photos on my site – the browser downloads the image from the URL to a temporary file and uploads it, then WordPress makes a bunch of thumbnails. Then I add it to a folder (provided by the Folders plugin – which I hacked a bit to make less annoying) by date. This is, of course, horribly inefficient given that the image is already on the server. So I started playing around with using a symbolic link instead, and found the wp-cli command-line tool, which is excellent and has good help, and stitched together a Python program that can add/remove photos automatically, creating a by-date folder and putting the image into it, and removing it on delete if empty.

This saves a bunch of disk space (significant given I plan to add a lot of images and the base images are pretty big) and makes my posting workflow easier too. In future maybe I’ll make a way to choose photos via a UI plugin so it’s even more seamless. I’m using the FooGallery plugin for galleries (and their lightbox too); I tried a few, liked it best.

This entry was posted in Technical. Bookmark the permalink.

Leave a Reply