if ( ! $size )
return new WP_Error( 'invalid_image', __('Could not read image size.'), $this->file );
+ if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
+ imagealphablending( $this->image, false );
+ imagesavealpha( $this->image, true );
+ }
+
$this->update_size( $size[0], $size[1] );
$this->mime_type = $size['mime'];
* Processes current image and saves to disk
* multiple sizes from single source.
*
+ * 'width' and 'height' are required.
+ * 'crop' defaults to false when not provided.
+ *
* @since 3.5.0
* @access public
*
- * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
+ * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
* @return array
*/
public function multi_resize( $sizes ) {
$orig_size = $this->size;
foreach ( $sizes as $size => $size_data ) {
+ if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
+ continue;
+
+ if ( ! isset( $size_data['crop'] ) )
+ $size_data['crop'] = false;
+
$image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
if( ! is_wp_error( $image ) ) {
* @since 3.5.0
* @access public
*
- * @param boolean $horz Horizontal Flip
- * @param boolean $vert Vertical Flip
+ * @param boolean $horz Flip along Horizontal Axis
+ * @param boolean $vert Flip along Vertical Axis
* @returns boolean|WP_Error
*/
public function flip( $horz, $vert ) {
return imagejpeg( $this->image, null, $this->quality );
}
}
+
+ /**
+ * Either calls editor's save function or handles file as a stream.
+ *
+ * @since 3.5.0
+ * @access protected
+ *
+ * @param string|stream $filename
+ * @param callable $function
+ * @param array $arguments
+ * @return boolean
+ */
+ protected function make_image( $filename, $function, $arguments ) {
+ if ( wp_is_stream( $filename ) )
+ $arguments[1] = null;
+
+ return parent::make_image( $filename, $function, $arguments );
+ }
}