~ubuntu-branches/debian/jessie/wordpress/jessie

« back to all changes in this revision

Viewing changes to wp-includes/class-wp-image-editor-imagick.php

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-04-17 20:56:19 UTC
  • mfrom: (1.2.35)
  • Revision ID: package-import@ubuntu.com-20140417205619-nurbet6eho4yvwfv
Tags: 3.9+dfsg-1
* New upstream release
* 3.9 seems to handle different locations for plugins so the
  plugin directory handling patches have been cut back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
        /**
212
212
         * Resizes current image.
213
213
         *
 
214
         * At minimum, either a height or width must be provided.
 
215
         * If one of the two is set to null, the resize will
 
216
         * maintain aspect ratio according to the provided dimension.
 
217
         *
214
218
         * @since 3.5.0
215
219
         * @access public
216
220
         *
217
 
         * @param int $max_w
218
 
         * @param int $max_h
219
 
         * @param boolean $crop
 
221
         * @param  int|null $max_w Image width.
 
222
         * @param  int|null $max_h Image height.
 
223
         * @param  boolean  $crop
220
224
         * @return boolean|WP_Error
221
225
         */
222
226
        public function resize( $max_w, $max_h, $crop = false ) {
255
259
         * @param array $sizes {
256
260
         *     An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
257
261
         *
 
262
         *     Either a height or width must be provided.
 
263
         *     If one of the two is set to null, the resize will
 
264
         *     maintain aspect ratio according to the provided dimension.
 
265
         *
258
266
         *     @type array $size {
259
 
         *         @type int  $width  Image width.
260
 
         *         @type int  $height Image height.
 
267
         *         @type int  ['width']  Optional. Image width.
 
268
         *         @type int  ['height'] Optional. Image height.
261
269
         *         @type bool $crop   Optional. Whether to crop the image. Default false.
262
270
         *     }
263
271
         * }
264
 
         * @return array An array of resized images metadata by size.
 
272
         * @return array An array of resized images' metadata by size.
265
273
         */
266
274
        public function multi_resize( $sizes ) {
267
275
                $metadata = array();
272
280
                        if ( ! $this->image )
273
281
                                $this->image = $orig_image->getImage();
274
282
 
275
 
                        if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
 
283
                        if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
276
284
                                continue;
277
 
 
278
 
                        if ( ! isset( $size_data['crop'] ) )
 
285
                        }
 
286
 
 
287
                        if ( ! isset( $size_data['width'] ) ) {
 
288
                                $size_data['width'] = null;
 
289
                        }
 
290
                        if ( ! isset( $size_data['height'] ) ) {
 
291
                                $size_data['height'] = null;
 
292
                        }
 
293
 
 
294
                        if ( ! isset( $size_data['crop'] ) ) {
279
295
                                $size_data['crop'] = false;
 
296
                        }
280
297
 
281
298
                        $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
282
299