Month: July 2011

  • Mass re-uploading of media with WordPress and Cache Images

    For quite a while in the past, I was in the bad habit of uploading the media associated with my posts in a separate storage directory on the server. I didn’t even bother to categorize it much, just dumped the stuff in ad-hoc subdirectories and forgot about it.

    Over time, the storage directory became unmaintainable as stuff kept piling in and it was difficult to keep track of which pages each file was associated with. At the same time the built-in media handling in WordPress became quite efficient and accessible. So I switched to using that instead.

    But there was still the problem of past media, laying around in the old storage directory, uncategorized, linked to in god knows where. I began to manually fix old posts referring to the storage, but there were dozens and dozens of pages worth of posts to fix individually, so I soon grew tired.

    I was planning to write some one-time code to do the per-post re-uploading, when I discovered Cache Images. I quickly realized I could exploit it to my benefit in this case: using another alias for my server I could make Cache Images re-upload each file for me.

    I began with individual files to see if everything would work as planned. Turns out there was a slight cosmetic error in the upload: the files would go into the current month’s upload directory instead of the directory corresponding to the old post’s date. This was bug #16777 in WordPress’ tracker, and there was a diff file I could patch my WordPress installation with. Luckily, the patch worked just fine and now the images each went to their respective monthly directories.

    There’s still the issue of WP Smush.it not working properly. I’m told that Yahoo! are in the process of switching servers, which should hopefully fix the errors I’m getting, but in the meantime I’ve disabled smushing altogether. It’s too bad, it would’ve been good to get the pictures smushed en masse while re-uploading.

  • Warlock theme for WordPress

    warlock is a WordPress theme which began as a brach of nihil, but yet again with a different focus: to be an exercise in HTML5 and jQuery.

    Screenshot: Warlock applied to WordPress The code is released under Creative Commons’ CC0 1.0 Universal license… Apart from the bits I stole from various other people. I’ve credited them sparsely with URL’s accompanying their code.

    As always, this is a work in progress, so it might punch babies when launched.

    Download: warlock-2011-07-07_19-19.zip (74 kB)