Ticket #16984: 16984.diff
File 16984.diff, 1.9 KB (added by , 14 years ago) |
---|
-
trunk/wordpress-importer.php
822 822 $post_id = wp_insert_attachment( $post, $upload['file'] ); 823 823 wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) ); 824 824 825 // remap the thumbnail url. this isn't perfect because we're just guessing the original url.826 if ( preg_match( ' @^image/@', $info['type'] ) && $thumb_url = wp_get_attachment_thumb_url( $post_id) ) {825 // remap resized image URLs, works by stripping the extension and remapping the URL stub. 826 if ( preg_match( '!^image/!', $info['type'] ) ) { 827 827 $parts = pathinfo( $url ); 828 $ext = $parts['extension']; 829 $name = basename($parts['basename'], ".{$ext}"); 830 $this->url_remap[$parts['dirname'] . '/' . $name . '.thumbnail.' . $ext] = $thumb_url; 828 $name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2 829 830 $parts_new = pathinfo( $upload['url'] ); 831 $name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" ); 832 833 $this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new; 831 834 } 832 835 833 836 return $post_id; … … 886 889 887 890 // keep track of the old and new urls so we can substitute them later 888 891 $this->url_remap[$url] = $upload['url']; 889 $this->url_remap[$post['guid']] = $upload['url']; 890 // if the remote url is redirected somewhere else, keep track of the destination too892 $this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed? 893 // keep track of the destination if the remote url is redirected somewhere else 891 894 if ( isset($headers['x-final-location']) && $headers['x-final-location'] != $url ) 892 895 $this->url_remap[$headers['x-final-location']] = $upload['url']; 893 896