Main

August 04, 2007

Blogging with TextMate

So I tried writing and posting the past few entries using TextMate's blogging bundle. It's cool. You can write and post directly to your compatible blog from within TextMate. Dragging and dropping an image into the file you're editing will automatically upload it to the server and insert the correct markup into your post.

However, under Movable Type images are automatically uploaded into the "site root" directory specified under "Settings", and I wasn't so into the idea of having zillions of images dumped into one folder and mixed with all the index files.

So I modified the blogging bundle so that it will upload into a dynamic directory based on the date. There may be an easier solution that I didn't find.

Find the blogging bundle at TextMate.app/Contents/SharedSupport/Bundles/Blogging.tmbundle. Open it in TextMate and look for Blogging.tmbundle->Support->lib->blogging.rb. In the function upload_name_for_path, change the line:

prefix = mode == 'wp' ? '' : Time.now.strftime('%F_')

to

prefix = mode == 'wp' ? '' : 'photos/'+Time.now.strftime('%Y/%m/%d/')

(or whatever you prefer).

Instead of files appearing at http://www.site.com/blog/2007-08-04_name.jpg, they will appear in http://www.site.com/blog/photos/2007/08/04/name.jpg.

(Now, of course, I just have to figure out how to auto-rotate the images based on the exif data. The utility jhead should do this, but I haven't worked out how to pass everything through Automator.)

November 01, 2005

Also, broken.

I killed my blog.

Will fix later. Maybe.

Gah.

(Ignore the 500 error while commenting. Your comment should still show up.)