mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
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
This commit is contained in:
parent
3bb105109b
commit
8b20551951
@ -241,7 +241,7 @@ class WP_Image_Editor_GD extends WP_Image_Editor {
|
||||
if ( is_resource( $dst ) ) {
|
||||
imagedestroy( $this->image );
|
||||
$this->image = $dst;
|
||||
$this->update_size( $dst_w, $dst_h );
|
||||
$this->update_size();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -317,13 +317,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
|
||||
$dst_h = $src_h;
|
||||
|
||||
$this->image->scaleImage( $dst_w, $dst_h );
|
||||
return $this->update_size( $dst_w, $dst_h );
|
||||
return $this->update_size();
|
||||
}
|
||||
}
|
||||
catch ( Exception $e ) {
|
||||
return new WP_Error( 'image_crop_error', $e->getMessage() );
|
||||
}
|
||||
return $this->update_size( $src_w, $src_h );
|
||||
return $this->update_size();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,8 +185,8 @@ abstract class WP_Image_Editor {
|
||||
*/
|
||||
protected function update_size( $width = null, $height = null ) {
|
||||
$this->size = array(
|
||||
'width' => $width,
|
||||
'height' => $height
|
||||
'width' => (int) $width,
|
||||
'height' => (int) $height
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user