'Stores configuration options for image styles.',
'fields' => array(
'isid' => array(
'description' => 'The primary identifier for an image style.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The style name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
),
'primary key' => array('isid'),
'unique keys' => array(
'name' => array('name'),
),
);
$schema['image_effects'] = array(
'description' => 'Stores configuration options for image effects.',
'fields' => array(
'ieid' => array(
'description' => 'The primary identifier for an image effect.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'isid' => array(
'description' => 'The {image_styles}.isid for an image style.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => 'The weight of the effect in the style.',
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
),
'name' => array(
'description' => 'The unique name of the effect to be executed.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'data' => array(
'description' => 'The configuration data for the effect.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array('ieid'),
'indexes' => array(
'isid' => array('isid'),
'weight' => array('weight'),
),
'foreign keys' => array(
'image_style' => array(
'table' => 'image_styles',
'columns' => array('isid' => 'isid'),
),
),
);
return $schema;
}
/**
* Implements hook_field_schema().
*/
function image_field_schema($field) {
return array(
'columns' => array(
'fid' => array(
'description' => 'The {file_managed}.fid being referenced in this field.',
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
'alt' => array(
'description' => "Alternative image text, for the image's 'alt' attribute.",
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
'title' => array(
'description' => "Image title text, for the image's 'title' attribute.",
'type' => 'varchar',
'length' => 128,
'not null' => FALSE,
),
),
'indexes' => array(
'fid' => array('fid'),
),
'foreign keys' => array(
'fid' => array(
'table' => 'file_managed',
'columns' => array('fid' => 'fid'),
),
),
);
}
/**
* Implements hook_requirements() to check the PHP GD Library.
*
* @param $phase
*/
function image_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
// Check for the PHP GD library.
if (function_exists('imagegd2')) {
$info = gd_info();
$requirements['image_gd'] = array(
'value' => $info['GD Version'],
);
// Check for filter and rotate support.
if (function_exists('imagefilter') && function_exists('imagerotate')) {
$requirements['image_gd']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['image_gd']['severity'] = REQUIREMENT_ERROR;
$requirements['image_gd']['description'] = t('The GD Library for PHP is enabled, but was compiled without support for functions used by the rotate and desaturate effects. 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 the PHP manual.');
}
}
else {
$requirements['image_gd'] = array(
'value' => t('Not installed'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The GD library for PHP is missing or outdated. Check the PHP image documentation for information on how to correct this.', array('@url' => 'http://www.php.net/manual/book.image.php')),
);
}
$requirements['image_gd']['title'] = t('GD library rotate and desaturate effects');
}
return $requirements;
}