You are here

max_image_size.install in Max Image Size 7

Install and update hooks.

File

max_image_size.install
View source
<?php

/**
 * @file
 * Install and update hooks.
 */

/**
 * Implements hook_schema().
 */
function max_image_size_schema() {
  $schema['max_image_size'] = array(
    'description' => 'Keeps track of processed files.',
    'fields' => array(
      'fid' => array(
        'description' => 'The {file_managed} identifier for a file.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the process entry was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the process entry was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'width' => array(
        'description' => 'The width of the image.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'height' => array(
        'description' => 'The height of the image.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
    'indexes' => array(
      'process_changed' => array(
        'changed',
      ),
      'process_created' => array(
        'created',
      ),
    ),
    'foreign keys' => array(
      'file_managed' => array(
        'table' => 'file_managed',
        'columns' => array(
          'fid' => 'fid',
        ),
      ),
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function max_image_size_uninstall() {
  variable_del('max_image_size_width');
  variable_del('max_image_size_height');
  variable_del('max_image_size_cron_enabled');
  variable_del('max_image_size_presave_enabled');
  variable_del('max_image_size_filesize_threshold');
}

Functions