WPSSO needs to know which image libraries WordPress is using, so it can make sure those PHP extension modules exist. You may be surprised to know, but some sites do not have ImageMagick *or* GD installed. That’s a problem when WordPress must provide an image of a specific size (and not the full size image).
So, a full example from WPSSO looks like this (edited for brevity):
$editors = array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' );
$implementations = apply_filters( 'wp_image_editors', $editors );
$extensions = array(
'curl' => array(
'label' => 'Client URL Library (cURL)',
'url' => 'https://secure.php.net/manual/en/book.curl.php',
),
'gd' => array(
'label' => 'Image Processing (GD)',
'url' => 'https://secure.php.net/manual/en/book.image.php',
),
'imagick' => array(
'label' => 'Image Processing (ImageMagick)',
'url' => 'https://secure.php.net/manual/en/book.imagick.php',
),
'json' => array(
'label' => 'JavaScript Object Notation (JSON)',
'url' => 'https://secure.php.net/manual/en/book.json.php',
),
'mbstring' => array(
'label' => 'Multibyte String',
'url' => 'https://secure.php.net/manual/en/book.mbstring.php',
),
'simplexml' => array(
'label' => 'SimpleXML',
'url' => 'https://secure.php.net/manual/en/book.simplexml.php',
),
);
/**
* Only check for PHP image extensions that WordPress is actually using. :)
*/
foreach ( $editors as $class_name ) {
if ( ! in_array( $class_name, $implementations ) ) {
switch ( $class_name ) {
case 'WP_Image_Editor_Imagick':
unset ( $extensions['imagick'] );
break;
case 'WP_Image_Editor_GD':
unset ( $extensions['gd'] );
break;
}
}
}
foreach ( $extensions as $php_ext => $php_info ) {
if ( ! extension_loaded( $php_ext ) ) {
/**
* Show an error message for the missing extension module.
*/
}
}
js.