mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Media: Support Stream Wrappers In WP_Image_Editor_Imagick
Since `WP_Image_Editor`'s introduction, stream wrappers have functioned in `WP_Image_Editor_GD`, but haven't been properly supported in `WP_Image_Editor_Imagick`. - Detects stream wrappers and uses `file_put_contents()` along with `Imagick::read/getImageBlob()` for handling when necessary. - Introduces private method, `WP_Image_Editor_Imagick::write_image` to handle detection and proper saving. - Introduces `WP_Test_Stream` class for testing stream wrappers, along with new tests for Imagick's stream handling and a stream filename test. Adds requirement for `Imagick::readImageBlob()`, available in Imagick >= 2.0.0, which aligns with the current requirement of Imagick >= 2.2.0. Props p00ya, calin, joemcgill, pputzer, jimyaghi, mikeschroder. Fixes #42663. git-svn-id: https://develop.svn.wordpress.org/trunk@49230 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -365,9 +365,13 @@ abstract class WP_Image_Editor {
|
||||
$new_ext = strtolower( $extension ? $extension : $ext );
|
||||
|
||||
if ( ! is_null( $dest_path ) ) {
|
||||
$_dest_path = realpath( $dest_path );
|
||||
if ( $_dest_path ) {
|
||||
$dir = $_dest_path;
|
||||
if ( ! wp_is_stream( $dest_path ) ) {
|
||||
$_dest_path = realpath( $dest_path );
|
||||
if ( $_dest_path ) {
|
||||
$dir = $_dest_path;
|
||||
}
|
||||
} else {
|
||||
$dir = $dest_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user