media-tools-for-WordPress icon indicating copy to clipboard operation
media-tools-for-WordPress copied to clipboard

Parsing Error: External Images for posts imported from Livejournal to Wordpress

Open peterkirs opened this issue 12 years ago • 6 comments

Thanks Chris Olbekson, I have got the reference on your marvelous tool.

http://wordpress.org/support/topic/plugin-add-linked-images-to-gallery-simply-removes-the-src-tag-result-empty-image?replies=2#post-3035230

Media tools works perfect, but there is a bug which is very important for me. I imported many posts from LiveJournal to Wordpress with Livejournal Import (LJ import version as June 2012),

but your media tool cannot convert images from these imported posts. E.g the Log: Will the EUR/CHF never rise over 1.22 again ? as in http://backup.snbchf.com/2012/03/will-the-eurchf-never-rise-over-1-22-again/

Running import media tool Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Img already in media library Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Img already in media library Img already in media library Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Img already in media library Img already in media library Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url Upload Error: Could not upload image. Check for malformed img src url No external images found for Will the EUR/CHF never rise over 1.22 again ?

or one simple image in http://backup.snbchf.com/2012/05/the-vicious-cycle-of-the-us-economy-or-why-the-us-dollar-must-ultimately-fall-again/

Log: Running import media tool Upload Error: Could not upload image. Check for malformed img src url No external images found for The vicious cycle of the US economy or why the US dollar must ultimately fall again

Media tool complete (Post ID 23) in 3.108 seconds. 1 errors

Such an un-parsable image is:

peterkirs avatar Aug 19 '12 13:08 peterkirs

Hi thanks for taking the time to submit this. Looking at the src attribute the images are missing the file extension.

<p><a href="http://pics.livejournal.com/georgedorgan/pic/0003q44e/"><img style="border-width: 0px; border-style: solid;" src="http://pics.livejournal.com/georgedorgan/pic/0003q44e/s640x480" alt="" width="640" height="143"></a></p>

The plugin uses the WordPress media_sideload_image function which requires a full url including file extension to work. Even though the images work in the browser WordPress will return the WP_Error object when it encounters the file.

c3mdigital avatar Aug 19 '12 15:08 c3mdigital

Thanks for the quick reply. That explains a lot, why the plugin "add images to gallery" not works, but maybe also why I cannot do Wordpress XML export and import.

http://wordpress.org/support/topic/wordpress-import-creates-masses-of-duplicated-media-not-more?replies=7#post-3040465 The import actually creates lots of duplicated images.

Means anybody who migrated from Livejournal to Wordpress will not be able to use your tool.

peterkirs avatar Aug 20 '12 04:08 peterkirs

HI Chris, I added the file extension to all images in one post manually. The images got imported source attribute got correctly changed. Unfortunately the images still link to life journal via HREF

This is an important feature which is missing in your tool: Usually when you import posts (from another blog) then both HREF and SRC point to the old blog and are equal.

This implies that in the case that HREF=SRC then you should replace both SRC and HREF by the imported image. --> you probably do that already ?

In my case: SRC = HREF.[FileExtension] --> you do not replace HREF

peterkirs avatar Aug 20 '12 06:08 peterkirs

I am considering adding this feature. It would have to be via an opt in option to make sure that is what the user wants.

c3mdigital avatar Aug 22 '12 09:08 c3mdigital

The issue of the missing file extension handling is being worked on for WordPress core. The bug hasn't been accepted yet but thanks to your feedback along with other users I'm going try and get it pushed through. See http://core.trac.wordpress.org/ticket/18730#comment:3 for more info.

The logical way to handle this is read the file headers and add the correct extension based on the mime type instead of relying on the extension.

c3mdigital avatar Aug 24 '12 04:08 c3mdigital

Thank you, I got the same issue not only with life journal, but also with imported gravatars.

peterkirs avatar Aug 24 '12 09:08 peterkirs