/*
* Even though Imagick uses less PHP memory than GD, set higher limit
* for users that have low PHP.ini limits.
*/
wp_raise_memory_limit( 'image'
);
try { $this->image =
new Imagick();
$file_extension =
strtolower( pathinfo( $this->file, PATHINFO_EXTENSION
) );
if ( 'pdf' ===
$file_extension ) { $pdf_loaded =
$this->
pdf_load_source();
if ( is_wp_error( $pdf_loaded ) ) { return $pdf_loaded;
} } else { if ( wp_is_stream( $this->file
) ) { // Due to reports of issues with streams with `Imagick::readImageFile()`, uses `Imagick::readImageBlob()` instead.
$this->image->
readImageBlob( file_get_contents( $this->file
),
$this->file
);
} else { $this->image->
readImage( $this->file
);
} }