Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#16984 closed defect (bug) (fixed)

WP Importer doesn't properly remap resized images

Reported by: duck_'s profile duck_ Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version:
Component: Import Keywords: has-patch
Focuses: Cc:

Description

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.

Mapping thumbnails introduced in [6428] and unchanged since then. For the 'new' naming scheme for resized images see [7041], [7135].

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"

to:

"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.

Attachments (1)

16984.diff (1.9 KB) - added by duck_ 14 years ago.

Download all attachments as: .zip

Change History (3)

@duck_
14 years ago

#1 @duck_
14 years ago

Committed http://plugins.trac.wordpress.org/changeset/365761/wordpress-importer so the reporter on the forum can test as well.

#2 @duck_
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Closing this one as fixed now.

Note: See TracTickets for help on using tickets.