Publii icon indicating copy to clipboard operation
Publii copied to clipboard

Improve images import from WordPress

Open dziudek opened this issue 5 years ago • 1 comments

ref. https://publii.ticksy.com/ticket/1662994

So, I imported the WordPress XMR from my old site into Publii.

I published the imported WordPress articles to a new site.

It seems the images have an absolute link so they continue to be hotlinked to the old site.

I realize this is a tricky area because how do you tell which images are absolute links from the previous WordPress site.

It'd be nice if Publii could somehow rewrite the URLs so they are not absolute and point to the media locally as if I attached them as a new post in Publii.

I could also manually move the images from the old site to the new site, but I'm not sure how I go about rewriting the image URLs.

Maybe I need to do a deep-dive into SQLite in Publii?
Yes, the images were added through WordPress media manager. I believe when the WordPress export takes place, the image URLs are absolute so something like:

<img src="https://thedomain.com/wp-content/uploads/2018/08/fluffypony.jpg">
I guess a checkbox where if the img gives a 200 and you can download it, the URL becomes relative and the image is available locally.

What would you do with non-WordPress uploaded media (hot links and other sites)... I suppose you would know because the WordPress content upload has a predictable URL scheme.

dziudek avatar Sep 10 '19 12:09 dziudek

Hi, I'm also facing this issue, and it's currently the major blocker for importing a few very image-heavy blogs into Publii.

Basically, what happens is that the thumbnails, small embedded images are downloaded correctly, but the links keep pointing to the actual site, and the large images are not downloaded (which can be seen by checking /input/media/posts/NNN ).

If you could point to the right place in the importer code where this action takes place, I'd be interested to take a look.

mgc8 avatar Sep 01 '20 22:09 mgc8