I’ve moved from WordPress to Ghost and used the TryGhost/Migrate script to scrape XML.
It all worked and the site is live.
However: the scraper did lowercase all in image-filenames, but not lowercase the filenames in the database posts table.
So i thought to rewrite the filenames in the posts table - html field with this:
UPDATE posts
SET html = REGEXP_REPLACE(
html,
'img src="([^"]+)"',
CONCAT('img src="', LOWER(SUBSTRING_INDEX(SUBSTRING_INDEX(html, 'img src="', -1), '"', 1)), '"')
)
it works, unless you’ve got multiple images, then it rewrites and replaces all images with the first image of the post.
Any ideas how to solve this?