function image_requirements in Image 7
Same name and namespace in other branches
- 6 image.install \image_requirements()
Implementation of hook_requirements().
File
- ./
image.install, line 66
Code
function image_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
// Make sure we've got a working toolkit
if ($toolkit = image_get_toolkit()) {
$requirements['image_toolkit'] = array(
'value' => t('The %toolkit_name toolkit is installed.', array(
'%toolkit_name' => $toolkit,
)),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['image_toolkit'] = array(
'value' => t('Not installed.'),
'severity' => REQUIREMENT_ERROR,
'description' => t('No image toolkit is currently enabled. Without one the image module will not be able to resize your images. You can select one from the <a href="@link">image toolkit settings page</a>.', array(
'@link' => url('admin/settings/image-toolkit'),
)),
);
}
$requirements['image_toolkit']['title'] = t('Image toolkit');
// File paths
$image_path = file_create_path(file_directory_path() . '/' . variable_get('image_default_path', 'images'));
$temp_path = $image_path . '/temp';
if (!file_check_directory($image_path, FILE_CREATE_DIRECTORY)) {
$requirements['image_dirs'] = array(
'value' => t('Missing directory.'),
'severity' => REQUIREMENT_ERROR,
'description' => t("The image module's image directory %image_dir is missing.", array(
'%image_dir' => $image_path,
)),
);
}
else {
if (!file_check_directory($temp_path, FILE_CREATE_DIRECTORY)) {
$requirements['image_dirs'] = array(
'value' => t('Missing temp directory.'),
'severity' => REQUIREMENT_ERROR,
'description' => t("The image module's temp directory %temp_dir is missing.", array(
'%temp_dir' => $temp_path,
)),
);
}
else {
$requirements['image_dirs'] = array(
'value' => t('Exists (%path).', array(
'%path' => $image_path,
)),
'severity' => REQUIREMENT_OK,
);
}
}
$requirements['image_dirs']['title'] = t('Image module directories');
}
return $requirements;
}