Commit Graph

60 Commits

Author SHA1 Message Date
Dominik Schilling
aa561e67a1 Bootstrap: Enhance core's memory limit handling.
* Don't lower memory limit if the current limit is greater than `WP_MAX_MEMORY_LIMIT`.
* Set `WP_MEMORY_LIMIT` and `WP_MAX_MEMORY_LIMIT` to current limit if the `memory_limit` setting can't be changed at runtime.
* Use `wp_convert_hr_to_bytes()` when parsing the value of the `memory_limit` setting because it can be a shorthand or an integer value.
* Introduce `wp_raise_memory_limit( $context )` to raise the PHP memory limit for memory intensive processes. This DRYs up some logic and includes the existing `admin_memory_limit` and `image_memory_limit` filters. The function can also be used for custom contexts, the `{$context}_memory_limit` filter allows to customize the limit.
* Introduce `wp_is_ini_value_changeable( $setting )` to determine whether a PHP ini value is changeable at runtime.
* Remove a `function_exists( 'memory_get_usage' )` check. Since PHP 5.2.1 support for memory limit is always enabled.

Related commits: [38011-38013]

Props jrf, A5hleyRich, swissspidy, ocean90.
Fixes #32075.
Built from https://develop.svn.wordpress.org/trunk@38015


git-svn-id: http://core.svn.wordpress.org/trunk@37956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 14:37:30 +00:00
Drew Jaynes
311f800907 Docs: Ensure hook and duplicate hook docs directly precede all instances of the image_memory_limit filter.
Hook docs must directly precede hooks in order for the Code Reference parser to correctly identify them as such.

Fixes #36968. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@37560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-30 02:14:30 +00:00
Drew Jaynes
a7c601b74f Docs: Correct a duplicate filter comment for the image_memory_limit hook to point to the correct file.
Props bobbingwide.
See #36968.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-30 02:10:30 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Mike Schroder
5102c98ab6 Media: Resolve fatal error on resize with ImageMagick < 6.4.6
Improper checking for 'Imagick::ALPHACHANNEL_UNDEFINED' and
'Imagick::ALPHACHANNEL_OPAQUE' caused fatal errors for some users
with Imagick when compiled against ImageMagick < 6.4.6, when these
constants were introduced. Fixes these compatibility checks.

Props gblsm.
Fixes #36501.
Built from https://develop.svn.wordpress.org/trunk@37192


git-svn-id: http://core.svn.wordpress.org/trunk@37158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-13 06:18:28 +00:00
Mike Schroder
9af79e2582 Media: Fall back to GD when loading URL in HHVM Imagick.
HHVM does not currently support loading URLs in its port of Imagick.
Fixes `test_wp_crop_image_url()` failure introduced in [36916].

See #35973.
Built from https://develop.svn.wordpress.org/trunk@36996


git-svn-id: http://core.svn.wordpress.org/trunk@36963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-15 00:15:26 +00:00
Dominik Schilling
4497ddfcb2 Media: Merge two error messages and use sprintf() for the method names.
See #33642.
Built from https://develop.svn.wordpress.org/trunk@36968


git-svn-id: http://core.svn.wordpress.org/trunk@36936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 23:36:26 +00:00
Aaron Jorbin
1972aa2a2a Add grunt prerelease task
An unintended consequence of improving the precommit task is that when it's time to run a release, more tasks need to get run to verify things. This adds a prerelease task to help fix that situation. grunt prerelease should include tasks that verify the code base is ready to be released to the wild and find all the tears on the mausoleum floor and help Blood stain the Colosseum doors.

See #35557

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


git-svn-id: http://core.svn.wordpress.org/trunk@36898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-10 05:37:27 +00:00
Mike Schroder
1e120a01ec Media: Progressive enhancement for Imagick; add profiles to whitelist.
- Progressive enhancement for optional compression improvements and stripping meta.
- Whitelist IPTC and XMP profiles to maintain Copyright and Rights Usage Terms.
- Whitelist EXIF profile to maintain orientation information. If handled on upload in the future, it can be stripped as well.

Fixes #33642. See #28634.
Props joemcgill, juliobox, ahockley, markoheijnen, adamsilverstein, wonderboymusic, mikeschroder.
Built from https://develop.svn.wordpress.org/trunk@36891


git-svn-id: http://core.svn.wordpress.org/trunk@36858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 04:44:26 +00:00
Drew Jaynes
bbc3cde9b0 Docs: Improve DocBlock syntax and add a missing @return notation for WP_Image_Editor_Imagick::strip_meta(), introduced in [36700].
See: #33642, #30402, #28634. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 17:37:27 +00:00
Drew Jaynes
d8f8f68d42 Docs: Improve the hook doc summary for the image_strip_meta filter, introduced in [36700].
See: #33642, #30402, #28634. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-04 17:33:26 +00:00
Mike Schroder
f3afec6974 Media: Correct "Exception" typo in WP_Image_Editor_Imagick::strip_meta().
Exceptions are caught better if they're not excpeted.

Props joemcgill.
See #33642.
Built from https://develop.svn.wordpress.org/trunk@36742


git-svn-id: http://core.svn.wordpress.org/trunk@36709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-26 21:58:26 +00:00
Mike Schroder
2656dff5ad Media: Optimize Imagick settings for quality and filesize
- Resamples and sharpens larger images before resize.
- Uses imagick::FILTER_TRIANGLE for a smoother resize.
- Introduces `WP_Image_Editor_Imagick::thumbnail_image()` protected method to efficiently resize images. Similar to the functionality of Imagick's `thumbnailImage()`.
- Introduces `WP_Image_Editor_Imagick::strip_meta()` protected method and `image_strip_meta` filter that, by default, strip image profiles to reduce file size, while leaving color profiles intact.

See: #33642, #30402, #28634.
Props: joemcgill, dnewton, mikeschroder.
Built from https://develop.svn.wordpress.org/trunk@36700


git-svn-id: http://core.svn.wordpress.org/trunk@36667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 22:51:26 +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
Drew Jaynes
b1b3fc5deb Docs: Re-clarify the $sizes[ $size ] section of the hash notations for WP_Image_Editor_GD::multi_resize() and WP_Image_Editor_Imagick::multi_resize() as not fully-optional.
The `$width` value is optional if `$height` is specified, and vice versa. The `$crop` value is always optional and defaults to false.

Props dh-shredder.
See #32246. See [35061] and [35062].

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


git-svn-id: http://core.svn.wordpress.org/trunk@35028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:34:23 +00:00
Drew Jaynes
041e3dd285 Docs: Fix hash notation syntax for the $sizes[ $size ] section in the DocBlock for WP_Image_Editor_Imagick::multi_resize().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:27:24 +00:00
Dominik Schilling
93a5af5753 Image Editor: Merge two error strings.
Props pavelevap.
See #22623.
Built from https://develop.svn.wordpress.org/trunk@34841


git-svn-id: http://core.svn.wordpress.org/trunk@34806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-05 22:40:25 +00:00
Scott Taylor
84da11d918 Pass false as the 2nd argument to class_exists() to disable autoloading and to not cause problems for those who define __autoload().
Fixes #20523.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 03:52:25 +00:00
Sergey Biryukov
3fb3d2a762 Replace @returns with @return in PHP docblocks.
props kraftbj.
fixes #32865.
Built from https://develop.svn.wordpress.org/trunk@33052


git-svn-id: http://core.svn.wordpress.org/trunk@33023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-02 21:05:24 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Scott Taylor
5c6b63d3a6 if is a statment, not a function.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 20:01:25 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Drew Jaynes
7a7df47087 Add a proper description comment for the WP_Image_Editor_Imagick->$image property.
See [30180]. See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-23 19:20:24 +00:00
Scott Taylor
bf43be3e9e Add missing doc blocks to wp-image-editor*.php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 06:18:25 +00:00
Scott Taylor
dbc38ea246 In the ->multi_resize() method of the WP_Image_Editor subclasses, when looping through potential crops, we need to make sure the crop isn't the exact same dimensions as the original image before copying it as a new crop.
This ensures that we don't save multiple copies of the same image.

Supposedly broke in [30639], but this logic was always missing. When I tested reverting [30639], there were still 2 files being created.

Fixes #31296.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 19:38:27 +00:00
Scott Taylor
5547115dc2 Fix some @param docs that have chars too close them.
Add `@property` annotations to `WP_User` and `WP_Post`.
Remove erroneous `@param`s from image editor class methods.
Officially add the property `$_column_headers` to `WP_List_Table`.	

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:57:22 +00:00
Scott Taylor
42f5acd869 Improve some docs for @param. Remove an unneeded $wpdb global import.
See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-20 20:56:22 +00:00
Scott Taylor
e02c724249 WP_Image_Editor_GD and WP_Image_Editor_Imagick should specify type in a doc block for the $image property, instead of inferring bool and null.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 02:38:23 +00:00
Sergey Biryukov
221db8fd8d Fix setting default quality in WP_Image_Editor.
props markoheijnen.
fixes #29856 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29834


git-svn-id: http://core.svn.wordpress.org/trunk@29598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-04 13:12:15 +00:00
Scott Taylor
cf95c6ecc2 Add ->get_quality() method to WP_Image_Editor class.
Adds unit tests.

Props markoheijnen.
Fixes #28154.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 03:50:15 +00:00
Scott Taylor
df8a090193 Add missing access modifiers to methods/members in WP_Image_Editor_* classes.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:53:14 +00:00
Scott Taylor
85731fc99b In multi_resize() image editor methods, assert that null can only be passed for one of the arguments, not both. Add a lot more unit test assertions to ensure this.
Props pbearne, DH-Shredder.
Fixes #26823.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 20:40:17 +00:00
Ryan Boren
07c16fd23c The Pinking Shears stir from their slumber, awakened by what may seem, to those
innocent in the ways of The Shears, a triviality, a nothing-of-consequence. But there are consequences indeed for recklessly trailing your whitespace. Naturally, they a dire!

One, two! One, two! And through and through
The Pinking Shears went snicker-snack!
They plucked your tail and with your space
They went sniksnuking back.

Let me tell you, that can be uncomfortable, so always pre-sniksnuk your trailing whites. May The Shears be with you.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-11 19:49:11 +00:00
Andrew Nacin
feedbcde87 Improvements to image quality handling in the image editor classes.
props markoheijnen, DH-Shredder.
fixes #25721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-04 22:49:10 +00:00
Drew Jaynes
4ffec6be75 Improve inline documentation for the multi_resize() method in WP_Image_Editor, WP_Image_Editor_GD, and WP_Image_Editor_Imagick.
Props paolal for the initial patch.
Fixes #25530.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-08 17:19:09 +00:00
Andrew Nacin
21767e446e Fix non-square rotations when using the Imagick image editor.
props DH-Shredder.
fixes #22663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-09-28 06:37:11 +00:00
Andrew Nacin
25e9adef27 Remove debug.
git-svn-id: http://core.svn.wordpress.org/trunk@24766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 17:13:41 +00:00
Andrew Nacin
35eec2dd57 Confirm we are dealing with an Imagick object. see #24539.
git-svn-id: http://core.svn.wordpress.org/trunk@24765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-22 17:01:00 +00:00
Mark Jaquith
cc3bd4bca1 @-silence an Imagick call that causes a warning in PHP 5.4.
props DH-Shredder. fixes #24539.

git-svn-id: http://core.svn.wordpress.org/trunk@24568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-05 18:43:45 +00:00
Andrew Nacin
feffc2716f Image editors: multi_resize() should require height and width. Crop is now optional and defaults to false. props DH-Shredder. fixes #23884.
git-svn-id: http://core.svn.wordpress.org/trunk@24055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-22 20:28:05 +00:00
Ryan Boren
87db798028 Clarify phpdoc for the vertical and horizontal arguments to the flip() method in WP_Image_Editor*.
Props dh-shredder
fixes #23775


git-svn-id: http://core.svn.wordpress.org/trunk@23750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-19 03:30:04 +00:00
Andrew Nacin
aac3ea45f3 Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.
git-svn-id: http://core.svn.wordpress.org/trunk@23133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-09 17:02:22 +00:00
Andrew Nacin
8b20551951 Image editors: After cropping, request new sizes from the image. If we rely on the values passed in, they may be floats. We must see what the image results in.
Cast in update_size() for sanity.

props DH-Shredder.
fixes #22779.



git-svn-id: http://core.svn.wordpress.org/trunk@23103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 07:56:04 +00:00
Andrew Nacin
b20c0a5bd5 Image editor doc fixes. props DH-Shredder. see #6821.
git-svn-id: http://core.svn.wordpress.org/trunk@23038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 19:42:28 +00:00
Ryan Boren
63539ff739 Increase the PHP memory_limit to WP_MAX_MEMORY_LIMIT in WP_Image_Editor_Imagick.
Props DH-Shredder
fixes #22699


git-svn-id: http://core.svn.wordpress.org/trunk@22997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-03 19:44:58 +00:00
Andrew Nacin
01e11b6b23 Explicitly check for version 2.2.0 or higher of the Imagick PHP module, to ensure we can call queryFormats() statically. props DH-Shredder, fixes #22308.
git-svn-id: http://core.svn.wordpress.org/trunk@22904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-28 21:41:44 +00:00
Ryan Boren
1afc32e84a Clean up WP_Image_Editor_Imagick::test(). Props DH-Shredder. see #22543
git-svn-id: http://core.svn.wordpress.org/trunk@22864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 14:52:24 +00:00
Ryan Boren
e52a437bc2 More feature detection in WP_Image_Editor_Imagick::test().
Check existence of setIteratorIndex().

Props DH-Shredder, markoheijnen
see #22543



git-svn-id: http://core.svn.wordpress.org/trunk@22849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-26 22:40:34 +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