Created
September 19, 2012 01:27
-
-
Save Japh/3747095 to your computer and use it in GitHub Desktop.
ImageMagick Test for WP_Image_Editor_Imagemagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function find_exec() { | |
exec( "type convert", $type, $type_rcode ); | |
if ( ! $type_rcode ) { | |
$convert_type = explode( ' ', $type[0] ); | |
$this->convert_bin = $convert_type[0]; | |
} else { | |
exec( "locate " . escapeshellarg( "*/convert" ), $locate, $locate_rcode ); | |
foreach ( $locate as $binary ) { | |
if ( '/usr/local/bin/convert' == $binary || '/usr/bin/convert' == $binary ) { | |
$this->convert_bin = $binary; | |
} | |
} | |
} | |
} | |
public static function test() { | |
$this->find_exec(); | |
exec( $this->convert_bin . ' -version', $output, $return_code ); | |
if ( $return_code ) | |
return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment