15 lines
595 B

data =
# Replace the image paths to be accessible in Wordpress.
# The new path given here is the path for my case: A multi-site blog. The 1970/01
# in the path was determined by setting a date during extract_media.rb.
# Upload a file to your media gallery and look at the image url to determine
# your correct path.
images = data.scan(/(?:src|href)="(\/uploads\/.+?)"/)
images.each do |path|
data = data.gsub("="#{path}"", "="/wp-content/uploads/sites/5/1970/01/#{File.basename(path)}"")
puts data.gsub(/([^>])\n/, "\\1 ")