~ubuntu-branches/debian/sid/wordpress/sid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2013-09-04 23:18:58 UTC
  • mfrom: (1.2.28)
  • Revision ID: package-import@ubuntu.com-20130904231858-nljmn1buzswh63jk
Tags: 3.6+dfsg-1
* New upstream release.
* Improve wp-settings to verify that $_SERVER['HTTP_X_FORWARDED_PROTO']
  exists before accessing it (avoids a PHP notice).
  Thanks to Paul Dreik <slask@pauldreik.se> for the report and the patch.
* Document in README.Debian the need to login to /wp-admin/ to complete
  an upgrade.
* Drop useless debian/README.source
* Drop 008CVE2008-2392.patch since upstream now disables unfiltered
  uploads by default. See http://core.trac.wordpress.org/ticket/10692
* Drop 009CVE2008-6767.patch since the backto parameter is validated
  against a whitelist, and externally triggered upgrades are not a
  security problem as long as they work.
* Update debian/missing-sources with latest versions.
* Update upstream l10n.

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
                if ( ! $size )
98
98
                        return new WP_Error( 'invalid_image', __('Could not read image size.'), $this->file );
99
99
 
 
100
                if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
 
101
                        imagealphablending( $this->image, false );
 
102
                        imagesavealpha( $this->image, true );
 
103
                }
 
104
 
100
105
                $this->update_size( $size[0], $size[1] );
101
106
                $this->mime_type = $size['mime'];
102
107
 
173
178
         * Processes current image and saves to disk
174
179
         * multiple sizes from single source.
175
180
         *
 
181
         * 'width' and 'height' are required.
 
182
         * 'crop' defaults to false when not provided.
 
183
         *
176
184
         * @since 3.5.0
177
185
         * @access public
178
186
         *
179
 
         * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
 
187
         * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
180
188
         * @return array
181
189
         */
182
190
        public function multi_resize( $sizes ) {
184
192
                $orig_size = $this->size;
185
193
 
186
194
                foreach ( $sizes as $size => $size_data ) {
 
195
                        if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
 
196
                                continue;
 
197
 
 
198
                        if ( ! isset( $size_data['crop'] ) )
 
199
                                $size_data['crop'] = false;
 
200
 
187
201
                        $image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
188
202
 
189
203
                        if( ! is_wp_error( $image ) ) {
279
293
         * @since 3.5.0
280
294
         * @access public
281
295
         *
282
 
         * @param boolean $horz Horizontal Flip
283
 
         * @param boolean $vert Vertical Flip
 
296
         * @param boolean $horz Flip along Horizontal Axis
 
297
         * @param boolean $vert Flip along Vertical Axis
284
298
         * @returns boolean|WP_Error
285
299
         */
286
300
        public function flip( $horz, $vert ) {
387
401
                                return imagejpeg( $this->image, null, $this->quality );
388
402
                }
389
403
        }
 
404
 
 
405
        /**
 
406
         * Either calls editor's save function or handles file as a stream.
 
407
         *
 
408
         * @since 3.5.0
 
409
         * @access protected
 
410
         *
 
411
         * @param string|stream $filename
 
412
         * @param callable $function
 
413
         * @param array $arguments
 
414
         * @return boolean
 
415
         */
 
416
        protected function make_image( $filename, $function, $arguments ) {
 
417
                if ( wp_is_stream( $filename ) )
 
418
                        $arguments[1] = null;
 
419
 
 
420
                return parent::make_image( $filename, $function, $arguments );
 
421
        }
390
422
}