Make WordPress Core


Ignore:
Timestamp:
01/02/2016 03:53:21 AM (9 years ago)
Author:
dd32
Message:

Responsive images: add compatibility for versions < 2.7 when the full image path was stored in the metadata. Introduces _wp_get_attachment_relative_path() and uses it in wp_get_attachment_url().

Merges [36120] to the 4.4 branch.
Props dd32, SergeyBiryukov.
Fixes #35106.

Location:
branches/4.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

  • branches/4.4/src/wp-includes/post.php

    r36105 r36151  
    48704870                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
    48714871            } elseif ( false !== strpos($file, 'wp-content/uploads') ) {
    4872                 $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     4872                // Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
     4873                $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . basename( $file );
    48734874            } else {
    48744875                // It's a newly-uploaded file, therefore $file is relative to the basedir.
Note: See TracChangeset for help on using the changeset viewer.