Commit Graph

643 Commits

Author SHA1 Message Date
Andrew Ozz
2d94e025a2 Replace wp_upload_dir() with the new wp_get_upload_dir() in all cases where a file is not being uploaded. Deprecate _wp_upload_dir_baseurl(), and replace it with wp_get_upload_dir().
See #34359.
Built from https://develop.svn.wordpress.org/trunk@36569


git-svn-id: http://core.svn.wordpress.org/trunk@36536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 00:24:27 +00:00
Rachel Baker
cf0288e291 Media: Fix inline docs typo inside wp_calculate_image_srcset() function.
mathces -> matches.

Props neoxx.

Fixes #35714.
Built from https://develop.svn.wordpress.org/trunk@36517


git-svn-id: http://core.svn.wordpress.org/trunk@36484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-12 18:15:30 +00:00
Pascal Birchler
fdb6bbfa10 Media: After [36240], remove some unneeded whitespace.
Props ocean90.
See #35367.
Built from https://develop.svn.wordpress.org/trunk@36241


git-svn-id: http://core.svn.wordpress.org/trunk@36208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 14:29:26 +00:00
Pascal Birchler
8ee945d82f Media: Fix wp_audio_shortcode and wp_video_shortcode attributes handling.
Although documented, the `class` and `style` attributes were simply ignored.
Adds unit tests.

Fixes #35367.
Built from https://develop.svn.wordpress.org/trunk@36240


git-svn-id: http://core.svn.wordpress.org/trunk@36207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 14:18:27 +00:00
Andrew Ozz
d03333735f Responsive images: fix the check whether the attachment meta matches the image src to work with http/https and CDNs.
Props webaware, joemcgill, azaozz.
Fixes #35045 and #35102 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36121


git-svn-id: http://core.svn.wordpress.org/trunk@36087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-30 01:04:27 +00:00
Andrew Ozz
597bbf0318 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().
Props dd32, SergeyBiryukov.
Fixes #35106 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36120


git-svn-id: http://core.svn.wordpress.org/trunk@36086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-30 00:06:28 +00:00
Andrew Ozz
698b825760 Responsive images: when creating srcset do not exclude the image size which is in the src attribute even when it is larger than max_srcset_image_width.
Props joemcgill.
Fixes #35108 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36110


git-svn-id: http://core.svn.wordpress.org/trunk@36075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-28 02:29:28 +00:00
Andrew Ozz
6e49a963b1 Responsive images: fix calculations when determining whether to include particular image file in srcset.
Props joemcgill.
Fixes #34955 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36031


git-svn-id: http://core.svn.wordpress.org/trunk@35996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-20 02:39:32 +00:00
Mike Schroder
6f3da8d57b Media: Don't generate responsive image attributes if src does not match ID in wp-image- class.
We rely on the `wp-image-` class to quickly find an attachment ID to add responsive image attributes.
To avoid incorrect images being displayed, do not add these attributes if the `src` does not match the
meta from the attachment ID in the class.

Props azaozz, kovshenin, joemcgill.
Fixes: #34898.

Built from https://develop.svn.wordpress.org/trunk@35820


git-svn-id: http://core.svn.wordpress.org/trunk@35784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-07 20:08:51 +00:00
Ella Iseulde Van Dorpe
657d3b50af Make date format consistent across the admin
The 'date_format' and 'time_format' options shouldn't affect the backend.

See #30864


Built from https://develop.svn.wordpress.org/trunk@35811


git-svn-id: http://core.svn.wordpress.org/trunk@35775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-07 04:26:27 +00:00
Scott Taylor
9b5ffe8062 Responsive Images: Currently images are included in the srcset if the aspect ratio difference is smaller than 0.01. This number is too high, set it to 0.002
Props joemcgill.
Fixes #34810.

Built from https://develop.svn.wordpress.org/trunk@35755


git-svn-id: http://core.svn.wordpress.org/trunk@35719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-01 20:58:24 +00:00
Scott Taylor
eaae2546f5 Media: don't use get_media_embedded_in_content() in wp_make_content_images_responsive().
Adds unit test.

Props azaozz.
Fixes #34807.

Built from https://develop.svn.wordpress.org/trunk@35753


git-svn-id: http://core.svn.wordpress.org/trunk@35717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-01 20:50:25 +00:00
Sergey Biryukov
bc1e479fd0 After [35718], update the location of some files in This filter is documented in docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Sergey Biryukov
4341637ba6 Docs: Remove redundant type strings from the wp_calculate_image_srcset filter DocBlock.
Props DH-Shredder, joemcgill.
See #34733.
Built from https://develop.svn.wordpress.org/trunk@35716


git-svn-id: http://core.svn.wordpress.org/trunk@35680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 06:16:26 +00:00
Sergey Biryukov
db4a87b0fd Docs: Add @see tags for wp_get_attachment_image_srcset() and wp_get_attachment_image_sizes().
Update `@see` tags for `wp_make_content_images_responsive()` and `wp_image_add_srcset_and_sizes()`.

Props jaspermdegroot.
See #34733.
Built from https://develop.svn.wordpress.org/trunk@35715


git-svn-id: http://core.svn.wordpress.org/trunk@35679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 06:13:26 +00:00
Drew Jaynes
b10a946c2c Docs: Clarify some parameter and return descriptions in the DocBlocks for wp_get_attachment_image_srcset() and wp_calculate_image_srcset(), wp_get_attachment_image_sizes(), and the wp_calculate_image_srcset filter.
Props joemcgill.
See #34733.

Built from https://develop.svn.wordpress.org/trunk@35696


git-svn-id: http://core.svn.wordpress.org/trunk@35660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 22:44:27 +00:00
Scott Taylor
13ea469061 Media: when making images responsive, check if they already have a sizes attribute.
Adds unit test.

Props jaspermdegroot.
Fixes #34678.

Built from https://develop.svn.wordpress.org/trunk@35678


git-svn-id: http://core.svn.wordpress.org/trunk@35642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:48:26 +00:00
Drew Jaynes
3a45270a43 Docs: Properly mark optional parameters as such in the DocBlock and function signature for wp_calculate_image_sizes().
Also updates the subsequent hook docs for the `wp_calculate_image_sizes` filter.

Props joemcgill.
Fixes #34612.

Built from https://develop.svn.wordpress.org/trunk@35672


git-svn-id: http://core.svn.wordpress.org/trunk@35636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 18:53:27 +00:00
Drew Jaynes
a90d108b82 Docs: Remove an empty line from the hook doc for the wp_calculate_image_srcset filter, introduced in [35592].
Props kraftbj.
See #34612.

Built from https://develop.svn.wordpress.org/trunk@35601


git-svn-id: http://core.svn.wordpress.org/trunk@35565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-10 17:15:29 +00:00
Drew Jaynes
c98b62c452 Docs: Fix some formatting in the hook doc for the wp_calculate_image_srcset filter and clarify the summary.
See #34612.

Built from https://develop.svn.wordpress.org/trunk@35592


git-svn-id: http://core.svn.wordpress.org/trunk@35556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-09 23:34:27 +00:00
Andrew Ozz
7d0aa3a54a Responsive images: properly arrange the parameters for the wp_calculate_image_srcset filter and add fix the inline documentation.
Props joemcgill.
Fixes #34612.
Built from https://develop.svn.wordpress.org/trunk@35591


git-svn-id: http://core.svn.wordpress.org/trunk@35555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-09 23:30:26 +00:00
Andrew Ozz
1b44ae6663 Responsive images: make the new functions and filters signatures more consistent.
Props joemcgill.
Fixes #34612.
Built from https://develop.svn.wordpress.org/trunk@35569


git-svn-id: http://core.svn.wordpress.org/trunk@35533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 21:36:27 +00:00
Scott Taylor
e649fabb6a Accessibility: add missing alt attributes to a gaggle of <img>s.
Props afercia.
Fixes #34583.

Built from https://develop.svn.wordpress.org/trunk@35567


git-svn-id: http://core.svn.wordpress.org/trunk@35531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 16:12:27 +00:00
Andrew Ozz
72a1124c45 Responsive images: omit full size images from srcset attributes when the original file is an intermediate sized GIF so we don't accidentally add animation to an otherwise flat image. Update the tests to cover this case.
Props joemcgill, H-Shredder, SergeyBiryukov.
Fixes #34528.
Built from https://develop.svn.wordpress.org/trunk@35561


git-svn-id: http://core.svn.wordpress.org/trunk@35525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-07 02:10:25 +00:00
Andrew Ozz
09c16cb4ac Responsive images: do not generate srcset for GIFs that are inserted at full size. Prevents breaking animated GIFs.
Props joemcgill.
Fixes #34528.
Built from https://develop.svn.wordpress.org/trunk@35524


git-svn-id: http://core.svn.wordpress.org/trunk@35488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 21:44:25 +00:00
Andrew Ozz
9e436c7e0f Responsive images:
- Fix `_wp_upload_dir_baseurl()` to cache by blog_id.
- Replace `path_join()` with `trailingslashit()`, it's much faster.
- Rename $image_url to $image_src for consistency (used at about 50 other places).
- Couple of tests fixes.

See #34430.
Built from https://develop.svn.wordpress.org/trunk@35498


git-svn-id: http://core.svn.wordpress.org/trunk@35462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 00:22:26 +00:00
Andrew Ozz
ea3d7c7962 Responsive images:
- More fixes to inline docs.
- Replace the last `wp_get_attachment_metadata()` with `get_post_meta()`.
- For consistency only accept array or named size in `wp_get_attachment_image_sizes()`.

Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35491


git-svn-id: http://core.svn.wordpress.org/trunk@35455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-03 00:19:28 +00:00
Andrew Ozz
26b6acd081 Responsive images: add $image_url parameter to wp_get_attachment_image_sizes() and use it in the filter. This allows themes and plugins to identify the image.
Props joemcgill.
Fixes #34477.
Built from https://develop.svn.wordpress.org/trunk@35481


git-svn-id: http://core.svn.wordpress.org/trunk@35445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 22:49:24 +00:00
Scott Taylor
d8eacd51d8 Media: add a new image size, medium_large. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.

Built from https://develop.svn.wordpress.org/trunk@35479


git-svn-id: http://core.svn.wordpress.org/trunk@35443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 20:50:25 +00:00
Andrew Ozz
8edcfabf9c Responsive images: few more inline docs fixes.
Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35465


git-svn-id: http://core.svn.wordpress.org/trunk@35429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-30 23:36:25 +00:00
Andrew Ozz
2021bc0da2 Responsive images:
- Merge `wp_image_srcset_attr()` into `wp_calculate_image_srcset()`.
- Remove the `wp_image_srcset` filter.
- Fix the tests for the above changes. 

See #34430.
Built from https://develop.svn.wordpress.org/trunk@35464


git-svn-id: http://core.svn.wordpress.org/trunk@35428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-30 23:27:24 +00:00
Andrew Ozz
d7da5970fa Responsive images: add inline docs for private functions.
Props swissspidy.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35426


git-svn-id: http://core.svn.wordpress.org/trunk@35390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-28 21:55:24 +00:00
Andrew Ozz
fd11ef9c45 Responsive images:
- Check if wp_get_attachment_metadata() has returned an array to prevent errors when using SVGs.
- Only add the srcset attribute if there will be a sizes attribute.
- Better filter names.
- Some more inline docs fixes.

Props jaspermdegroot.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35419


git-svn-id: http://core.svn.wordpress.org/trunk@35383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-28 20:01:26 +00:00
Andrew Ozz
61d21cc0d9 Responsive images:
- Introduce `wp_calculate_image_srcset()` that replaces `wp_get_attachment_image_srcset_array()` and is used as lower level function for retrieving the srcset data as array.
- Use the new function when generating `srcset` and `sizes` on the front-end. This is faster as no (other) image API functions are used.
- Change the `wp_get_attachment_image_srcset()`. Now it is meant for use in templates and is no longer used in core.
- A few logic fixes and improvements.
- Some names changed to be (hopefully) more descriptive.
- Fixed/updated tests.

Props joemcgill, jaspermdegroot, azaozz.
See #34430.
Built from https://develop.svn.wordpress.org/trunk@35412


git-svn-id: http://core.svn.wordpress.org/trunk@35376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-28 05:41:24 +00:00
Sergey Biryukov
1acf9e9e49 After [35402], don't unnecessary run wp_get_attachment_metadata(), wp_get_attachment_image_srcset(), and wp_get_attachment_image_sizes() in wp_img_add_srcset_and_sizes().
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35405


git-svn-id: http://core.svn.wordpress.org/trunk@35369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 18:42:24 +00:00
Sergey Biryukov
1e59e53dd2 After [35402], don't unnecessary run wp_get_attachment_image_srcset() and wp_get_attachment_image_sizes() in wp_get_attachment_image() if srcset is passed as an argument.
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35404


git-svn-id: http://core.svn.wordpress.org/trunk@35368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 18:40:24 +00:00
Sergey Biryukov
f5d0260e4d Remove assignments from conditions in wp_get_attachment_image() and wp_img_add_srcset_and_sizes().
See #34379.
Built from https://develop.svn.wordpress.org/trunk@35402


git-svn-id: http://core.svn.wordpress.org/trunk@35366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 16:29:26 +00:00
Sergey Biryukov
64a79eeffa Docs: After [34453], correct inline comments in wp_get_attachment_image_sizes().
Props jaspermdegroot.
Fixes #34453.
Built from https://develop.svn.wordpress.org/trunk@35401


git-svn-id: http://core.svn.wordpress.org/trunk@35365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-26 16:17:25 +00:00
Andrew Ozz
902f0f1a98 Responsive Images: fix typo in r35358.
Props aduth.
See #34341.
Built from https://develop.svn.wordpress.org/trunk@35378


git-svn-id: http://core.svn.wordpress.org/trunk@35342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-23 17:38:25 +00:00
Andrew Ozz
dfc2412be1 Responsive Images: limit the size of images included in srcset attributes. Introduce max_srcset_image_width filter to adjust the limit.
Props joemcgill.
Fixes #34341.
Built from https://develop.svn.wordpress.org/trunk@35358


git-svn-id: http://core.svn.wordpress.org/trunk@35324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-22 19:31:25 +00:00
Scott Taylor
318ad90a22 Media: in wp_get_attachment_image_sizes(), to streamline and for performance:
* Change the 3rd arg from `args` to `width`
* Change `wp_image_sizes_args` filter to `wp_get_attachment_image_sizes`

Updates unit tests.

Props joemcgill.
Fixes #34379.

Built from https://develop.svn.wordpress.org/trunk@35355


git-svn-id: http://core.svn.wordpress.org/trunk@35321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-22 16:46:24 +00:00
Drew Jaynes
81524f3bfc Filesystem: Following the introduction of the KB|MB|GB|TB_IN_BYTES constants in [35286], use them in various places in core.
Props sudar.
Fixes #22405.

Built from https://develop.svn.wordpress.org/trunk@35325


git-svn-id: http://core.svn.wordpress.org/trunk@35291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-21 14:03:25 +00:00
Drew Jaynes
3686b78448 Media: Introduce the image_get_intermediate_size filter to its like-named function, making it possible to manipulate returned intermedia image size data.
Covers both the default and meaningful short-circuit return cases. Also adds a hash notation to the return documentation in the DocBlock.

Props A5hleyRich, DH-Shredder, wonderboymusic.
Fixes #34124.

Built from https://develop.svn.wordpress.org/trunk@35289


git-svn-id: http://core.svn.wordpress.org/trunk@35255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 07:24:27 +00:00
Scott Taylor
443ce28304 Media: in wp_get_attachment_image_sizes(), ensure that $img_width exists when the image does not.
Props kraftbj.
See #33641.


Built from https://develop.svn.wordpress.org/trunk@35250


git-svn-id: http://core.svn.wordpress.org/trunk@35216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-17 22:12:24 +00:00
Drew Jaynes
d4711aff8a Docs: Fix a typo in an inline comment in wp_get_attachment_image_srcset_array().
Props neoxx.
Fixes #34319.

Built from https://develop.svn.wordpress.org/trunk@35210


git-svn-id: http://core.svn.wordpress.org/trunk@35176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-15 20:52:24 +00:00
Scott Taylor
affe1ab5ad Media: avoid "divide by zero" in wp_get_attachment_image_srcset_array().
Fixes #34238.

Built from https://develop.svn.wordpress.org/trunk@35081


git-svn-id: http://core.svn.wordpress.org/trunk@35046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 21:00:26 +00:00
Drew Jaynes
2d677edb1f Docs: The $size parameter for the get_image_tag hook also accepts an array.
See #34257. See [35038].

Built from https://develop.svn.wordpress.org/trunk@35078


git-svn-id: http://core.svn.wordpress.org/trunk@35043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:11:24 +00:00
Drew Jaynes
36ef44735d Docs: The $size parameter for the get_image_tag_class hook also accepts an array.
See #34257. See [35037].

Built from https://develop.svn.wordpress.org/trunk@35077


git-svn-id: http://core.svn.wordpress.org/trunk@35042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 17:09:25 +00:00
Drew Jaynes
d4fe129e1a Docs: Adjust the order of 'width' and 'height' (for consistency) for the $crop parameter documentation in image_make_intermediate_size().
Props jaspermdegroot.
See #34257.

Built from https://develop.svn.wordpress.org/trunk@35054


git-svn-id: http://core.svn.wordpress.org/trunk@35019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:06:24 +00:00
Drew Jaynes
8b26e5debc Docs: Adjust the order of 'width' and 'height' (for consistency) for the $crop parameter documentation in image_resize_dimensions().
Also similarly adjusts the `$crop` parameter description in the corresponding `image_resize_dimensions` hook doc.

Props jaspermdegroot.
See #34257.

Built from https://develop.svn.wordpress.org/trunk@35053


git-svn-id: http://core.svn.wordpress.org/trunk@35018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:02:24 +00:00