wordpress HTML import: image bugs/fixes

ok 2 bugs or issues that have cropped up while using Stephanie Leary’s otherwise wonderful HTML importer:

http://stephanieleary.com/code/wordpress/html-import/

I have fixed them by editing html-importer.php

You could too! – though I don’t really recommend this, since:

1. If the plugin is updated, any changes will be overwritten

2. I’m not 100% sure that I’ve made my edits in the most efficient place (they could perhaps be used for other media as well as images). So hoping Stephanie will take over or do something better, I guess :)

I’m making a note here in case the plugin is *not* updated and I encounter the same problem again in the future.

First bug: Query Parameters

When a file has a query parameter (e.g. “pic.jpg?w=150&h=23″) the file extension is not picked up.

Solution:

1. Find function handle_import_media_file

2. Find the commented section that starts/ends:

3. and paste, after it:

 

 

2nd bug: Embedded Images

When someone has embedded/pasted a image, instead of linking to a file, it sort of falls over. SO to fix this we need to a) handle the embedded / base64 file data and b) export them to a file, ready for import.

Solution:

1. Find function “import_images”

2. Find these lines:

3. replace them with

4.  Find function “handle_import_media_file”

5.  (as per the query string fix, above) find the commented out section that starts/ends

6. beneath it, add:

 

PS! Also! While testing all this out, I’ve found it’s really important to set the right home directory when importing single files. Otherwise all relative links break. duh ;)

Denne!

Another aspect of my daughter’s funky brain, is that she’s a late talker. Her understanding is very good, and she’s actually a great communicator – very expressive and good at miming what she wants – and we’ve tried to help by bringing in basic sign language, which she has been quite quick to pick up on – but basically she can’t articulate very well, and hasn’t yet mastered those tricky sounds like “k” and “p”

But she has all the vowels, and she’s a dab hand with “d” words. So far we have “down”, “done”, “dere” (there), “darrr” (dark), “door”, and of course “dad dad”.

This week, very excitingly, we have “Denne!” (that one! in swedish).

Now, *because* she is a great communicator, this hasn’t actually improved my understanding of what she wants (pointing, nodding and shaking the head has done pretty well so far) but it is absolutely marvellous to know *exactly* what she wants, and hear her articulate it :)

 

The Dreaded Twelve Kay

Yep, 12k. I have *so* many stories I’ve started, then abandonned, around the 10-12k mark.

The only ones I’ve ever ‘finished’ have been short stories around 12k.

And now, I’ve hit 12k on #155 and, having realised that, I’m staring at my screen thinking: Oh. My. God.

I should probably have a plan. Like, draw a line under this bit, do another block of 12k from somewhere further along the story, and then fill in the bit between.

Hm. That might work, actually.

I had a blogspot blog, when I last tried writing ‘seriously’, ten years ago (!!). I just had a look, and it’s still there. And on it, I’m panicking about never finishing anything.

The truth is, I have a ‘wip’ folder with far too many story ideas with 5 – 10k in them.

My plan, right now, is to have a rule where yes of course I can start a new story – but it has to be in the same world.

Well, two worlds. I have two worlds in one, see – deviously tricking even myself…

Right, back to it.