As I am lucky enough to be able to travel a bit in the near future, I thought of blogging a few pictures en route. I wanted to do this from my Androidphone (2.3) without the hassle of logging in some software or website, let alone to use some BS like Instagram. I’ll try to explain in all briefness.

The main idea behind this is to have some sort of sync-mechanism between the phone and the blog which automatically renders directories and pictures as HTML. I choose phpGraphy as my main tool. It supports a flat file database and renders any content in its /pictures/ folder based on date of creation.

Since I had some concerns to put the password for my main webspace into the hands of some random Android-app I created a uberspace for my pictures. If you’re in or near Germany I highly recommend these guys - great support, incredible features, almost anonymous. The next was to get BotSync on my phone which enables uploads via SSH. You just specify directory on your phone to be uploaded and the destination on the server - a very slim & fast app. So, I can take a picture, organize it via some file management app and upload it to my picture-uberspace.

To get it on my main webspace I used rsync with SSH. You can find plenty of tutorials on the net regarding this.

rsync -avze 'ssh -i /home/user/.ssh/id' user@host.de:/home/user/html/and-upload/ /home/user/html/phpgraphy/pictures

Since phpGraphy sometimes messes up the thumbnail creation with the original pics of my phone’s camera, I run mogrify to resize them. Because I want to resize every picture in any directory the ‘find’ will look for any file with a jpeg-extension; the mogrify will set any side of the pic to 1400px which is more than enough.

find /home/user/html/phpgraphy/pictures/ -name "*.jpg" -exec mogrify -resize '1400x1400>' {} ;

Of course, these tasks need to be automated. Cron will take over and run these two commands every morning at six o’clock.

crontab -e
0 6 * * * /home/user/sync.sh

phpGraphy supports furthermore a cool feature concerning the naming convention. You can set it up to use a EXIF field for the image’s name. A few apps like Photo Editor allow to edit the EXIF metadata on Android. So I edit the User Comment EXIF field and tell phpGraphy to use this field as title. Works!

The workflow:

Take picture --> (Edit EXIF data) --> Put into upload directory on phone --> run BotSync --> done.

The good thing is I can change this workflow really easy. I can log on my picture-uberspace from any computer without worrying about giving away important credentials and just put some pics in the upload-folder. Then, my main uberspace will fetch the pictures via rsync and puts them in phpgraphy/pictures.

Of course, one could say: just use some service other than Instagram if you don’t like it. But this way I can control my data w/o worry about some TOS, pricing plans or whatnot. And it’s more fun to use something you set up.