function imageapi_gd_requirements in ImageAPI 5
Same name and namespace in other branches
- 6 imageapi_gd.install \imageapi_gd_requirements()
File
- ./
imageapi_gd.install, line 3
Code
function imageapi_gd_requirements($phase) {
$requirements = array();
$t = get_t();
$gd = function_exists('imagegd2');
if (!$gd) {
$requirements['imageapi_gd'] = array(
'title' => $t('GD library'),
'value' => $t('Not installed'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('The GD library for PHP is missing or outdated. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array(
'@url' => 'http://www.php.net/manual/en/image.setup.php',
)),
);
return $requirements;
}
// Check image format support
foreach (array(
'gif',
'jpeg',
'png',
) as $format) {
if (function_exists('imagecreatefrom' . $format)) {
continue;
}
$requirements['imageapi_gd_' . $format] = array(
'title' => $t('GD !format Support', array(
'!format' => drupal_ucfirst($format),
)),
'value' => $t('Not installed'),
'severity' => REQUIREMENT_ERROR,
'description' => $t('PHP GD was not compiled with %format support.', array(
'%format' => $format,
)),
);
}
// check non required stuff aka not installation blockers.
if ($phase == 'runtime') {
$memory_limit = ini_get('memory_limit');
if (parse_size($memory_limit) < parse_size('96M')) {
$requirements['imageapi_gd_memory_limit'] = array(
'title' => $t('ImageCache PHP Memory Limit'),
'value' => $memory_limit,
'severity' => REQUIREMENT_WARNING,
'description' => $t('It is highly recommended that you set you PHP memory_limit to 96M to use imageapi_gd. A 1600x1200 images consumes ~45M of memory when decompressed and ImageAPI is often operating on two decompressed images at once.'),
);
}
if (!function_exists('imagerotate')) {
require_once drupal_get_path('module', 'imageapi') . '/imagerotate.inc';
}
if (IMAGEAPI_IMAGEROTATE_PHP == 1) {
$requirements['imageapi_gd_imagerotate'] = array(
'title' => $t('GD Image Rotation'),
'value' => $t('Low Quality / Poor Performance'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('The installed version of PHP GD does not support image rotations. It was probably compiled using the official GD libraries from http://www.libgd.org instead of the GD library bundled with PHP. You should recompile PHP --with-gd using the bundled GD library. See: @url. An implementation of imagerotate in PHP will used in the interim.', array(
'@url' => 'http://www.php.net/manual/en/image.setup.php',
)),
);
}
if (!function_exists('imagefilter')) {
require_once drupal_get_path('module', 'imageapi') . '/imagefilter.inc';
}
if (IMAGEAPI_IMAGEFILTER_PHP == 1) {
$requirements['imageapi_gd_imagefilter'] = array(
'title' => $t('GD Image Filtering'),
'value' => $t('Low Quality / Poor Performance'),
'severity' => REQUIREMENT_WARNING,
'description' => $t('The installed version of PHP GD does not support image filtering(desaturate, blur, negate, etc). It was probably compiled using the official GD libraries from http://www.libgd.org instead of the GD library bundled with PHP. You should recompile PHP --with-gd using the bundled GD library. See @url. An implementation of imagefilter in PHP will be used in the interim.', array(
'@url' => 'http://www.php.net/manual/en/image.setup.php',
)),
);
}
}
return $requirements;
}