WP Importer doesn't properly remap resized images
|Reported by:||duck_||Owned by:|
When importing attachments the importer will attempt to remap all the URLs in posts and postmeta. For images this is more complex since a number of different sized images are generated for use.
Unfortunately the current importer is still only attempting to remap the pre-2.5 image.thumbnail.ext URLs. The new scheme is image-WWWxHHH.ext.
Proposed solution is to strip the extension from the unsized URLs and map those instead. So change from mapping:
"http://export.site/wp-content/uploads/2005/03/IMG_1398.thumbnail.jpg" => "http://import.site/wp-content/uploads/2005/03/IMG_1398-150x150.jpg"
"http://export.site/wp-content/uploads/2005/03/IMG_1398" => "http://import.site/wp-content/uploads/2005/03/IMG_1398"
This stub mapping for images could allow for ignoring the normal longer remap rules ($this->url_remap[$url] = $upload['url'];) for images to save on some database queries.
A problem that might arise is if there are different image size settings on the export and import sites. So an exported post might contain an image img-200x200.jpg but the import site hasn't generated the appropriate size. For the first patch I'm ignoring this and saying that it's up to the user to ensure the settings are consistent. Potential future fixes include importing options or generating the extra sizes on the fly
Cross-reference thread on support forum.