You are here

function imagecrop_install in Image javascript crop 5

Same name and namespace in other branches
  1. 6 imagecrop.install \imagecrop_install()

Implementation of hook_install(). @todo postgresql support @todo add unique key on fid & presetid?

File

./imagecrop.install, line 47
Install file.

Code

function imagecrop_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = db_query("CREATE TABLE {imagecrop} (\n          fid INT UNSIGNED NOT NULL DEFAULT 0,\n          presetid INT UNSIGNED NOT NULL DEFAULT 0,\n          reference VARCHAR (40) NOT NULL DEFAULT '',\n          xoffset INT UNSIGNED NOT NULL DEFAULT 0,\n          yoffset INT UNSIGNED NOT NULL DEFAULT 0,\n          width INT UNSIGNED NOT NULL DEFAULT 0,\n          height INT UNSIGNED NOT NULL DEFAULT 0)\n          /*!40100 DEFAULT CHARACTER SET utf8 */\n    ");
      $ret[] = db_query("UPDATE {system} SET weight = 1 WHERE name = 'imagecrop'");
      $ret[] = db_query("ALTER TABLE {imagecrop} ADD scale VARCHAR( 10 ) NOT NULL DEFAULT 'original'");
      break;
    case 'pgsql':
      break;
  }
  if ($ret) {
    drupal_set_message(t('Imagecrop module installed succesfully.'));
  }
  else {
    drupal_set_message(t('Imagecrop module installation was unsuccessfull. Necessary database tables should be created by hand.', 'error'));
  }
  return $ret;
}