I’m planning on being on holiday later in the year (seeĀ Liverpool in the Autumn for more details ) and I’m planning on doing some blogging whilst we’re underway.
So I want to be able to write my posts on my laptop when I’m disconnected from the internet and then connect and push the post and its images up onto my live blog.
Normally you’d use an offline client of one form or another but I’m using my WordPress Plugin for Canalplan to easily add links to Canalplan places into my blog. So that means that I have to use a local copy of WordPress on my laptop and then move the post when its complete, and that is where the problems start.
There are lots of plugins for WordPress that allow you to do things like export whole blog or a post but many of them (including the Official WordPress ones) expect the source blog to be visible to the internet so they can pull the images over. or they rely on you exporting the whole database and re-importing it which would mean having a whole multi-site install on my laptop which is a bit OTT.
So I sat down yesterday and started coding and I’ve got something working pretty well already.
So I can export a post (along with all its attached media) from one blog into a zip file.
You then move that zip file to the new server
Then you import the zip file either into an existing post (so we overwrite the contents) or into a new post.
Its all working OK so far but there are a few issues to work through. As I have to do search and replace on the image urls then both blogs must have the same image sizes set up because WordPress appends the image sizes when it creates the different sizes:
-rw-rw-r-- 1 www-data www-data 7623937 May 8 14:31 IMG_1032.jpg
-rw-rw-r-- 1 www-data www-data 4483 May 8 14:31 IMG_1032-150x100.jpg
-rw-rw-r-- 1 www-data www-data 15115 May 8 14:31 IMG_1032-300x200.jpg
-rw-rw-r-- 1 www-data www-data 149647 May 8 14:31 IMG_1032-1024x683.jpg
-rw-rw-r-- 1 www-data www-data 59728 May 8 14:31 IMG_1032-619x413.jpg
So if those image sizes are different then the replaced strings in the new content don’t match the files that were created when we loaded the exported media files into the blog.
Also the exporter assumes that filenames are unique – its possible to have two files with the same name in two different upload directories on the source. But on the target system it puts all the files in the current upload directory. So what would happen here is the two original image urls would end up pointing at the single new object.
I’ve not tested it on anything but image files so far but its looking pretty good.
If I like it I might submit it to the WordPress Plugin Repository.
The mobile browser news feed for Facebook includes a section featuring “sponsored” pages which they think you might want to like. You can’t hide this section but their selection criteria is totally crap..
So lets start with this – I drive a Volvo…. A super car it isn’t and I’ve no real interest in cars like this
I’m married – so no I do not need “Dating Advices” Facebook seems to have decided to push dating sites (Russian Brides etc.) to anyone it can… which I think says a lot about the morality of the people running the company.
I’ve no idea what Ceramic Pro Marine is. OK I have a canal boat but its a rather long jump from that to this.
Radio controlled aircraft for the serious hobbyist. Nope – that’s not me… that’s another page that has wasted money paying Facebook to promote itself to the wrong target.
OK I said I was going to work on the electrics on the boat – but again one hell of a leap from there to this.
No – I have absolutely NO idea how Facebook even thought of this one..
Its a holiday destination. I’ve never shown any interest in going and even if I had maybe putting out a page in English might be more sensible