Changeset 38052
- Timestamp:
- 07/13/2016 03:23:27 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r38012 r38052 1143 1143 * @param string $image_src The 'src' of the image. 1144 1144 * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. 1145 1145 * @param int $attachment_id Image attachment ID or 0. 1146 1146 */ 1147 1147 $sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id ); … … 1155 1155 1156 1156 foreach ( $sources as $source ) { 1157 $srcset .= $source['url']. ' ' . $source['value'] . $source['descriptor'] . ', ';1157 $srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', '; 1158 1158 } 1159 1159 -
trunk/tests/phpunit/tests/media.php
r37915 r38052 1323 1323 1324 1324 /** 1325 * @ticket 36549 1326 * @ticket 33641 1327 */ 1328 function test_wp_calculate_image_srcset_with_spaces_in_filenames() { 1329 // Mock data for this test. 1330 $image_src = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test image-300x150.png'; 1331 $image_meta = array( 1332 'width' => 2000, 1333 'height' => 1000, 1334 'file' => '2015/12/test image.png', 1335 'sizes' => array( 1336 'thumbnail' => array( 1337 'file' => 'test image-150x150.png', 1338 'width' => 150, 1339 'height' => 150, 1340 'mime-type' => 'image/png', 1341 ), 1342 'medium' => array( 1343 'file' => 'test image-300x150.png', 1344 'width' => 300, 1345 'height' => 150, 1346 'mime-type' => 'image/png', 1347 ), 1348 'medium_large' => array( 1349 'file' => 'test image-768x384.png', 1350 'width' => 768, 1351 'height' => 384, 1352 'mime-type' => 'image/png', 1353 ), 1354 'large' => array( 1355 'file' => 'test image-1024x512.png', 1356 'width' => 1024, 1357 'height' => 512, 1358 'mime-type' => 'image/png', 1359 ), 1360 ), 1361 ); 1362 1363 $expected_srcset = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test%20image-300x150.png 300w, http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test%20image-768x384.png 768w, http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/2015/12/test%20image-1024x512.png 1024w'; 1364 1365 $this->assertSame( $expected_srcset, wp_calculate_image_srcset( array( 300, 150 ), $image_src, $image_meta ) ); 1366 } 1367 1368 /** 1325 1369 * @ticket 33641 1326 1370 */
Note: See TracChangeset
for help on using the changeset viewer.