John Blackbourn
d510413811
Docs: Fix various filter documentation.
...
See #38462 , #41017
Built from https://develop.svn.wordpress.org/trunk@41215
git-svn-id: http://core.svn.wordpress.org/trunk@41055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 14:34:44 +00:00
Joe McGill
d6bec79fe7
Media: Keep PDF previews from overwriting files.
...
Since support for PDF previews were added in [38949], it's possible
that the generated image file could overwrite an existing image file
with the same name. This uses `wp_unique_filename()` to avoid this
issue and adds a '-pdf' identifier on the end of filenames.
Props gitlost, derosj, mikeschroder, joemcgill.
Fixes #39875 . See #31050 .
Built from https://develop.svn.wordpress.org/trunk@40130
git-svn-id: http://core.svn.wordpress.org/trunk@40067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-27 15:39:47 +00:00
Joe McGill
efb191c2ed
Media: Allow PDF fallbacks filter to process custom sizes.
...
This fixes an oversight in [39246], which added a hook for filtering
the array of sizes used for PDF thumbnails, but failed to provide a way
for sizes added through `add_image_size()` to be processed.
Props gitlost.
Fixes #39231 . See #38594 .
Built from https://develop.svn.wordpress.org/trunk@39617
git-svn-id: http://core.svn.wordpress.org/trunk@39557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-16 20:30:42 +00:00
Joe McGill
36ac7287b0
Media: Make PDF preview sizes filterable.
...
This adds a new filter, `fallback_intermediate_image_sizes`, which
can be used to modify the array of image sizes created for previewing
PDFs in the media library and checks for the existence of sizes before
processing any image representations of a PDF.
Fixes #38594 .
Built from https://develop.svn.wordpress.org/trunk@39246
git-svn-id: http://core.svn.wordpress.org/trunk@39186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-15 13:26:30 +00:00
Mike Schroder
a8e304ec8e
Media: Add support for rendering PDF thumbnails.
...
When support for PDFs is available, on upload,
render 'Thumbnail', 'Medium', 'Large', and 'Full' sizes of
the first page, and save them in attachment meta.
Use these renders within Add Media, Media Gallery and List views,
Attachment Details, Post/Attachment Edit screens, and Attachment pages.
Support available by default via Imagick -> ImageMagick -> Ghostscript,
but can be provided by any `WP_Image_Editor` that supports PDFs.
Props adamsilverstein, azaozz, celloexpressions, desrosj, dglingren, ericlewis, ipstenu, joemcgill, joyously, markoheijnen, melchoyce, mikeschroder, tomauger.
Fixes #31050 .
Built from https://develop.svn.wordpress.org/trunk@38949
git-svn-id: http://core.svn.wordpress.org/trunk@38892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 07:28:32 +00:00
Scott Taylor
6f9f3b0c56
Media: remove function_exists()
call for ini_get()
in _load_image_to_edit_path()
.
...
Props dd32.
Fixes #37681 .
Built from https://develop.svn.wordpress.org/trunk@38333
git-svn-id: http://core.svn.wordpress.org/trunk@38274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:24:30 +00:00
Scott Taylor
d31456b615
Media: add a function, wp_get_additional_image_sizes()
, that wraps the retrieval of the global $_wp_additional_image_sizes
. Removes 6 global imports.
...
See #37699 .
Built from https://develop.svn.wordpress.org/trunk@38303
git-svn-id: http://core.svn.wordpress.org/trunk@38244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 04:37:28 +00:00
Drew Jaynes
c3055cc190
Docs: Standardize hook docs in wp-admin/* to use third-person singular verbs per the inline documentation standards for PHP.
...
See #36913 .
Built from https://develop.svn.wordpress.org/trunk@37488
git-svn-id: http://core.svn.wordpress.org/trunk@37456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:01:30 +00:00
Dominik Schilling
d8f3325c14
Docs: Correct grammar when referring to "a URL" vs "an URL" in several places.
...
Fixes #36218 .
Built from https://develop.svn.wordpress.org/trunk@36970
git-svn-id: http://core.svn.wordpress.org/trunk@36938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-12 12:39:27 +00:00
Dominik Schilling
cd892b86b4
Media: In wp_read_image_metadata()
make sure that IPTC keywords are UTF8 encoded.
...
Prevents missing `_wp_attachment_metadata` when an image contains keywords with latin extended characters.
Fixes #35316 .
Built from https://develop.svn.wordpress.org/trunk@36429
git-svn-id: http://core.svn.wordpress.org/trunk@36396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-01 14:53:27 +00:00
Drew Jaynes
79705d5cc1
Docs: Fix a typo in the 4.4.0 changlog entry in the intermediate_image_sizes_advanced
hook doc.
...
Props morganestes.
Fixes #35190 .
Built from https://develop.svn.wordpress.org/trunk@36054
git-svn-id: http://core.svn.wordpress.org/trunk@36019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-21 22:24:27 +00:00
Sergey Biryukov
7ad65267b6
Media: Avoid a PHP warning in wp_generate_attachment_metadata()
if $metadata
is not an array.
...
This was previously fixed in [25968], but accidentally reverted in [32545].
Props skithund.
Fixes #34599 .
Built from https://develop.svn.wordpress.org/trunk@35554
git-svn-id: http://core.svn.wordpress.org/trunk@35518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-06 09:25:26 +00:00
Scott Taylor
aa8c76258a
After [34374], ensure that $iptc
is defined.
...
See #33772 .
Built from https://develop.svn.wordpress.org/trunk@34378
git-svn-id: http://core.svn.wordpress.org/trunk@34342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 04:49:24 +00:00
Scott Taylor
1d513fe737
Media: In wp_read_image_metadata()
, include IPTC Keywords when available in $meta
.
...
Adds unit test.
Props swissspidy, dbru, SteveHoneyNZ.
Fixes #33772 .
Built from https://develop.svn.wordpress.org/trunk@34374
git-svn-id: http://core.svn.wordpress.org/trunk@34338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 04:19:24 +00:00
Scott Taylor
8cd584e6ed
In wp_generate_attachment_metadata()
, also pass $metadata
to the intermediate_image_sizes_advanced
filter.
...
Props amereservant, wonderboymusic.
Fixes #23401 .
Built from https://develop.svn.wordpress.org/trunk@34007
git-svn-id: http://core.svn.wordpress.org/trunk@33976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 18:04:24 +00:00
Scott Taylor
b56b9b3e5c
Add @global
annotations for wp-admin/*
.
...
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32642
git-svn-id: http://core.svn.wordpress.org/trunk@32612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-28 21:41:30 +00:00
Scott Taylor
af7a017f46
When calling unset()
, it is unnecessary to immediately precede it with a call to isset()
.
...
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32545
git-svn-id: http://core.svn.wordpress.org/trunk@32515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:47:25 +00:00
Sergey Biryukov
19f1d4f402
EXIF/IPTC captions should populate Caption (post_excerpt
) on upload, not Description (post_content
).
...
Make sure the caption is always set if found. Previously, if the caption was less than 80 characters, only the Title field would be set.
props beaulebens, ericlewis, bendoh, SergeyBiryukov.
fixes #22768 .
Built from https://develop.svn.wordpress.org/trunk@31694
git-svn-id: http://core.svn.wordpress.org/trunk@31675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 05:07:28 +00:00
Scott Taylor
8f0b626d13
Introduce a function, wp_attachment_is( $type, $post = 0 )
, to collapse the logic for determining whether an attachment is an image
, audio
, or video
.
...
This is admittedly a first pass. There needs to be a generic handler for when any other type is passed, but for now it accepts the whitelist.
See #25275 .
Built from https://develop.svn.wordpress.org/trunk@31645
git-svn-id: http://core.svn.wordpress.org/trunk@31626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-06 20:26:26 +00:00
Sergey Biryukov
19a43125cd
Don't try to read a non-existent Exif:Title tag in wp_read_image_metadata()
, as it's not a part of the Exif standard.
...
props tyxla.
fixes #31043 .
Built from https://develop.svn.wordpress.org/trunk@31462
git-svn-id: http://core.svn.wordpress.org/trunk@31443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-14 09:14:28 +00:00
Scott Taylor
4feecb922c
Use &&
instead of and
in the 3 places where and
was used.
...
See #30799 .
Built from https://develop.svn.wordpress.org/trunk@31099
git-svn-id: http://core.svn.wordpress.org/trunk@31080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 21:12:22 +00:00
Andrew Nacin
58dfcb9bb0
Validate image data.
...
Built from https://develop.svn.wordpress.org/trunk@30458
git-svn-id: http://core.svn.wordpress.org/trunk@30449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 15:25:22 +00:00
Scott Taylor
2ed316e16d
Add exif orientation
to data extracted in wp_read_image_metadata()
.
...
Props shanebp.
Fixes 28916.
Built from https://develop.svn.wordpress.org/trunk@29291
git-svn-id: http://core.svn.wordpress.org/trunk@29073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-24 22:14:16 +00:00
Drew Jaynes
097dc8ee15
Fix syntax for single- and multi-line comments in wp-admin-directory files.
...
See #28931 .
Built from https://develop.svn.wordpress.org/trunk@29206
git-svn-id: http://core.svn.wordpress.org/trunk@28990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 09:14:16 +00:00
Sergey Biryukov
8b272f4379
Remove mbstring_binary_safe_strlen(). Use mbstring_binary_safe_encoding() and reset_mbstring_encoding() directly.
...
fixes #28162 .
Built from https://develop.svn.wordpress.org/trunk@28808
git-svn-id: http://core.svn.wordpress.org/trunk@28617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 22:21:15 +00:00
Sergey Biryukov
9ceb642b2a
Introduce a binary-safe wrapper for strlen() and use it in seems_utf8(), utf8_uri_encode(), and wp_read_image_metadata().
...
Use binary-safe POMO_Reader::strlen() in MO::export_to_file_handle().
fixes #28162 .
Built from https://develop.svn.wordpress.org/trunk@28806
git-svn-id: http://core.svn.wordpress.org/trunk@28615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 14:48:14 +00:00
Sergey Biryukov
84422e6d7d
Add BMP to the list of displayable image types.
...
props ericlewis.
fixes #26808 .
Built from https://develop.svn.wordpress.org/trunk@28589
git-svn-id: http://core.svn.wordpress.org/trunk@28414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-27 13:25:14 +00:00
Scott Taylor
88b96dc036
In wp_read_image_metadata()
, the values from exif_read_data()
should only override values from iptcparse()
that are empty.
...
Props SergeyBiryukov.
Fixes #23706 .
Built from https://develop.svn.wordpress.org/trunk@28367
git-svn-id: http://core.svn.wordpress.org/trunk@28195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-11 05:54:15 +00:00
Drew Jaynes
181fe84d47
Align parameters in the hook docs for the attachment_thumbnail_args
filter.
...
See #27700 .
Built from https://develop.svn.wordpress.org/trunk@27997
git-svn-id: http://core.svn.wordpress.org/trunk@27827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 20:10:16 +00:00
Scott Taylor
7eb24edf4e
In wp_generate_attachment_metadata()
, when an audio or video files contains upload-able image bits in its ID3 tags, only upload it if the image has not already been uploaded. Determine this by checking for a _cover_hash
value in post meta that matches the md5
representation of the bits.
...
This prevents uploading an album of 10 songs and subsequently uploading 10 copies of the same album cover.
Props GregLone for the new filter/filter docs: `'attachment_thumbnail_args'`.
Fixes #27573 .
Built from https://develop.svn.wordpress.org/trunk@27863
git-svn-id: http://core.svn.wordpress.org/trunk@27694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-30 20:54:15 +00:00
Scott Taylor
38d1fb971f
Turn on thumbnail support for attachment:audio
and attachment:video
. Change conditionals to check for theme OR post type support when determining whether to turn on the Featured Image UI pieces in the admin.
...
Fixes #27460 .
Built from https://develop.svn.wordpress.org/trunk@27657
git-svn-id: http://core.svn.wordpress.org/trunk@27500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-23 02:35:14 +00:00
Andrew Nacin
fabb6d4898
Allow $crop in add_image_size() to receive crop anchors (top, left, right, bottom, center).
...
This also applies to set_post_thumbnail_size() and image_resize_dimensions().
props bradt, wonderboymusic, DH-Shredder.
fixes #19393 .
Built from https://develop.svn.wordpress.org/trunk@27472
git-svn-id: http://core.svn.wordpress.org/trunk@27317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 06:14:15 +00:00
Drew Jaynes
61538d3f5e
Inline documentation for hooks in wp-admin/includes/image.php.
...
Props theorboman, kpdesign.
Fixes #25832 .
Built from https://develop.svn.wordpress.org/trunk@27202
git-svn-id: http://core.svn.wordpress.org/trunk@27059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 06:27:13 +00:00
Andrew Nacin
d0cfa40983
Add jshintrc to qunit.
...
props jorbin.
see #25187 .
Built from https://develop.svn.wordpress.org/trunk@25992
git-svn-id: http://core.svn.wordpress.org/trunk@25925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-30 14:39:10 +00:00
Mark Jaquith
12d3fc7999
Add functions for generating metadata for video and audio, using the
...
ID3 library. Also allows themes/plugins to add thumbnail support
to these media types. Think stuff like album art, movie covers, and
video freeze-frames.
props wonderboymusic. fixes #23673
git-svn-id: http://core.svn.wordpress.org/trunk@23766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-21 04:55:42 +00:00
Sergey Biryukov
caf591b7aa
Declare the variable before using it. props danielbachhuber. fixes #23710 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-07 04:46:19 +00:00
Sergey Biryukov
2967871d34
Return WP_Error from wp_crop_image() if saving has failed. props macbrink. fixes #23325 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@23374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-02-02 02:01:59 +00:00
Andrew Nacin
9120cf3375
WP_Image_Editor: the last stand.
...
* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
* Lazy-load the WP_Image_Editor base class and editor implementations.
* Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
* Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().
props DH-Shredder, scribu, markoheijnen. fixes #22356 . see #6821 .
git-svn-id: http://core.svn.wordpress.org/trunk@22817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 09:52:16 +00:00
Andrew Nacin
f68b6006de
wp_generate_attachment_metadata() should not call WP_Image_Editor if there's nothing to resize. props mdawaffe. fixes #22438 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 14:26:52 +00:00
Ryan Boren
02d80201fa
In wp_crop_image(), preserve both src_file and src. src_file must be preserved even when url fopen is used so that we don't try to save to a filename based on the url.
...
see #6821
git-svn-id: http://core.svn.wordpress.org/trunk@22553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-13 00:03:55 +00:00
Ryan Boren
31e669df5a
Pass an attachment ID, not a file path, to _load_image_to_edit_path() from wp_crop_image(). This fixes handling of attachments that require url fopen to access the image.
...
Allow passing urls instead of just file paths to WP_Image_Editor_Imagick::load() and WP_Image_Editor_GD::load() so that attachments requiring URL fopen can be handled.
see #6821
git-svn-id: http://core.svn.wordpress.org/trunk@22538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 20:42:27 +00:00
Andrew Nacin
f965ff1c84
Cast image metadata focal_length and shutter_speed to strings to restore previous behavior when stripslashes_deep() converted these values. Avoids rounding errors without making a determination of which digit we should round to. props jcakec. fixes #22259 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@22319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-28 16:17:56 +00:00
Ryan Boren
da8d7a347a
Check for WP_Error return from WP_Image_Editor::get_instance().
...
Props markoheijnen
see #6821
git-svn-id: http://core.svn.wordpress.org/trunk@22192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 18:59:41 +00:00
Ryan Boren
b4d0be2d1a
Introduce WP_Image_Editor, WP_Image_Editor_Imagick, and WP_Image_Editor_GD. Abstracts image editing API and adds support for ImageMagick.
...
Props DH-Shredder, kurtpayne, markoheijnen
see #6821
git-svn-id: http://core.svn.wordpress.org/trunk@22094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-01 20:59:06 +00:00
Andrew Nacin
70ad7496a6
Deprecate wp_create_thumbnail(). props obenland. fixes #21555 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-23 17:48:24 +00:00
Andrew Nacin
2d1eae820f
Avoid mangling UTF-8 strings that may be present in image metadata. props SergeyBiryukov for the unit tests [UT665]. fixes #9417 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-18 23:38:25 +00:00
Andrew Nacin
670105e1fb
Remove 'hwstring_small' from attachment metadata and deprecate get_udims(). props SergeyBiryukov. fixes #21518 .
...
git-svn-id: http://core.svn.wordpress.org/trunk@21808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 01:38:26 +00:00
ryan
bce8cd343a
Make sure the path exists before copying. see #20657
...
git-svn-id: http://core.svn.wordpress.org/trunk@21039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-10 01:26:12 +00:00
azaozz
cb71d2fe62
Fix notice in wp_read_image_metadata() when EXIF ISOSpeedRatings is array, props nacin, fixes #20807
...
git-svn-id: http://core.svn.wordpress.org/trunk@20978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-02 01:39:00 +00:00
ryan
c0339644ea
Shears of vigorous pinking.
...
git-svn-id: http://core.svn.wordpress.org/trunk@20944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-05-27 16:25:43 +00:00