You are here

imagefield_crop.install in Imagefield Crop 7.2

Module installation file.

File

imagefield_crop.install
View source
<?php

/**
 * @file
 * Module installation file.
 */

/**
 * Implements hook_field_schema().
 */
function imagefield_crop_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' => 512,
        'not null' => FALSE,
      ),
      'title' => array(
        'description' => "Image title text, for the image's 'title' attribute.",
        'type' => 'varchar',
        'length' => 1024,
        'not null' => FALSE,
      ),
      'cropbox_x' => array(
        'description' => 'X coordinate of left top point of cropping area.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'cropbox_y' => array(
        'description' => 'Y coordinate of left top point of cropping area.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'cropbox_height' => array(
        'description' => 'Height value of cropping area.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'cropbox_width' => array(
        'description' => 'Width value of cropping area.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'indexes' => array(
      'fid' => array(
        'fid',
      ),
    ),
    'foreign keys' => array(
      'fid' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
  );
}
function imagefield_crop_update_7001() {
  variable_del('imagefield_crop_info');
}

/**
 * Enlarge size of Alt and Title columns.
 */
function imagefield_crop_update_7201() {
  $alt_spec = array(
    'type' => 'varchar',
    'length' => 512,
    'not null' => FALSE,
  );
  $title_spec = array(
    'type' => 'varchar',
    'length' => 1024,
    'not null' => FALSE,
  );
  $fields = _update_7000_field_read_fields(array(
    'module' => 'imagefield_crop',
    'storage_type' => 'field_sql_storage',
  ));
  foreach ($fields as $field_name => $field) {
    $tables = array(
      _field_sql_storage_tablename($field),
      _field_sql_storage_revision_tablename($field),
    );
    $alt_column = $field['field_name'] . '_alt';
    $title_column = $field['field_name'] . '_title';
    foreach ($tables as $table) {
      db_change_field($table, $alt_column, $alt_column, $alt_spec);
      db_change_field($table, $title_column, $title_column, $title_spec);
    }
  }
}

Functions

Namesort descending Description
imagefield_crop_field_schema Implements hook_field_schema().
imagefield_crop_update_7001
imagefield_crop_update_7201 Enlarge size of Alt and Title columns.