From d79e3b775b544fe3656d566b4b3148a0b6a1d398 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 20 Apr 2011 11:20:25 -0300 Subject: Renaming module (1) --- imagecache_auto.inc | 135 ++++++++++++++++++++++++++++++++++++++++ imagecache_auto.info | 5 ++ imagecache_auto.install | 50 +++++++++++++++ load_imagecache_presets.info | 5 -- load_imagecache_presets.install | 50 --------------- load_imagecache_presets.module | 135 ---------------------------------------- 6 files changed, 190 insertions(+), 190 deletions(-) create mode 100644 imagecache_auto.inc create mode 100644 imagecache_auto.info create mode 100644 imagecache_auto.install delete mode 100644 load_imagecache_presets.info delete mode 100644 load_imagecache_presets.install delete mode 100644 load_imagecache_presets.module diff --git a/imagecache_auto.inc b/imagecache_auto.inc new file mode 100644 index 0000000..e359d92 --- /dev/null +++ b/imagecache_auto.inc @@ -0,0 +1,135 @@ + $name)); + + // Set operation name. + if (isset($options['action'])) { + $operation = $options['action']; + } + else { + $operation = 'imagecache_scale_and_crop'; + } + + // Add preset actions. + $action = new stdClass(); + $action->presetid = $preset['presetid']; + $action->module = 'imagecache'; + $action->action = $operation; + $action->data = array('width' => $options['width'], 'height' => $options['height']); + drupal_write_record('imagecache_action', $action); +} + +/** + * Delete an ImageCache preset. + * + * @param $options + * Preset options. + */ +function load_imagecache_preset_delete($options) { + // Set preset name. + if (isset($options['name'])) { + $name = $options['name']; + } + else { + $name = $options['width'] .'x'. $options['height']; + } + + // Check if preset exists. + $preset = imagecache_preset_by_name($name); + if (!empty($preset)) { + imagecache_preset_delete(imagecache_preset_by_name($name)); + } +} + +/** + * Update imagecache presets. + * + * @param $old + * Old presets to be deleted. + * + * @param $new + * New presets to be created. + */ +function load_imagecache_presets_update($old = array(), $new = NULL) { + // Remove old presets. + foreach ($old as $options) { + load_imagecache_preset_delete($options); + } + + if ($new == NULL) { + load_imagecache_presets_create(); + } + else { + // Create new presets. + foreach ($new as $options) { + load_imagecache_preset_create($options); + } + } +} + +/** + * Return an array of common display resolutions. + */ +function load_imagecache_presets_load_imagecache_presets() { + return array( + array('width' => '90%', 'height' => '90%', 'operation' => 'imagecache_scale', 'name' => '0.90x0.90'), + array('width' => '80%', 'height' => '80%', 'operation' => 'imagecache_scale', 'name' => '0.80x0.80'), + array('width' => '70%', 'height' => '70%', 'operation' => 'imagecache_scale', 'name' => '0.70x0.70'), + array('width' => '60%', 'height' => '60%', 'operation' => 'imagecache_scale', 'name' => '0.60x0.60'), + array('width' => '50%', 'height' => '50%', 'operation' => 'imagecache_scale', 'name' => '0.50x0.50'), + array('width' => '40%', 'height' => '40%', 'operation' => 'imagecache_scale', 'name' => '0.40x0.40'), + array('width' => '30%', 'height' => '30%', 'operation' => 'imagecache_scale', 'name' => '0.30x0.30'), + array('width' => '20%', 'height' => '20%', 'operation' => 'imagecache_scale', 'name' => '0.20x0.20'), + array('width' => '10%', 'height' => '10%', 'operation' => 'imagecache_scale', 'name' => '0.10x0.10'), + array('width' => '95%', 'height' => '95%', 'operation' => 'imagecache_scale', 'name' => '0.95x0.95'), + array('width' => '85%', 'height' => '85%', 'operation' => 'imagecache_scale', 'name' => '0.85x0.85'), + array('width' => '75%', 'height' => '75%', 'operation' => 'imagecache_scale', 'name' => '0.75x0.75'), + array('width' => '65%', 'height' => '65%', 'operation' => 'imagecache_scale', 'name' => '0.65x0.65'), + array('width' => '55%', 'height' => '55%', 'operation' => 'imagecache_scale', 'name' => '0.55x0.55'), + array('width' => '45%', 'height' => '45%', 'operation' => 'imagecache_scale', 'name' => '0.45x0.45'), + array('width' => '35%', 'height' => '35%', 'operation' => 'imagecache_scale', 'name' => '0.35x0.35'), + array('width' => '25%', 'height' => '25%', 'operation' => 'imagecache_scale', 'name' => '0.25x0.25'), + array('width' => '15%', 'height' => '15%', 'operation' => 'imagecache_scale', 'name' => '0.15x0.15'), + array('width' => '5%', 'height' => '5%', 'operation' => 'imagecache_scale', 'name' => '0.05x0.05'), + ); +} diff --git a/imagecache_auto.info b/imagecache_auto.info new file mode 100644 index 0000000..20ac291 --- /dev/null +++ b/imagecache_auto.info @@ -0,0 +1,5 @@ +; $Id$ +name = "Load Image Cache Presets" +description = "Load a Set of Presets for modules using Imagecache " +core = 6.x +dependencies[] = imagecache diff --git a/imagecache_auto.install b/imagecache_auto.install new file mode 100644 index 0000000..9c88466 --- /dev/null +++ b/imagecache_auto.install @@ -0,0 +1,50 @@ +filename); + } + */ + + load_imagecache_presets_create(); +} + +/** + * Remove configuration data. + */ +function load_imagecache_presets_uninstall() { + /** + * Leave this commented out as it's better not to delete + * cached data until we find a reason for that. + */ + /* + $presets = imagecache_presets(); + foreach ($presets as $options) { + imagecache_preset_delete($options); + } + */ + + // Remove variables +} diff --git a/load_imagecache_presets.info b/load_imagecache_presets.info deleted file mode 100644 index 20ac291..0000000 --- a/load_imagecache_presets.info +++ /dev/null @@ -1,5 +0,0 @@ -; $Id$ -name = "Load Image Cache Presets" -description = "Load a Set of Presets for modules using Imagecache " -core = 6.x -dependencies[] = imagecache diff --git a/load_imagecache_presets.install b/load_imagecache_presets.install deleted file mode 100644 index 9c88466..0000000 --- a/load_imagecache_presets.install +++ /dev/null @@ -1,50 +0,0 @@ -filename); - } - */ - - load_imagecache_presets_create(); -} - -/** - * Remove configuration data. - */ -function load_imagecache_presets_uninstall() { - /** - * Leave this commented out as it's better not to delete - * cached data until we find a reason for that. - */ - /* - $presets = imagecache_presets(); - foreach ($presets as $options) { - imagecache_preset_delete($options); - } - */ - - // Remove variables -} diff --git a/load_imagecache_presets.module b/load_imagecache_presets.module deleted file mode 100644 index e359d92..0000000 --- a/load_imagecache_presets.module +++ /dev/null @@ -1,135 +0,0 @@ - $name)); - - // Set operation name. - if (isset($options['action'])) { - $operation = $options['action']; - } - else { - $operation = 'imagecache_scale_and_crop'; - } - - // Add preset actions. - $action = new stdClass(); - $action->presetid = $preset['presetid']; - $action->module = 'imagecache'; - $action->action = $operation; - $action->data = array('width' => $options['width'], 'height' => $options['height']); - drupal_write_record('imagecache_action', $action); -} - -/** - * Delete an ImageCache preset. - * - * @param $options - * Preset options. - */ -function load_imagecache_preset_delete($options) { - // Set preset name. - if (isset($options['name'])) { - $name = $options['name']; - } - else { - $name = $options['width'] .'x'. $options['height']; - } - - // Check if preset exists. - $preset = imagecache_preset_by_name($name); - if (!empty($preset)) { - imagecache_preset_delete(imagecache_preset_by_name($name)); - } -} - -/** - * Update imagecache presets. - * - * @param $old - * Old presets to be deleted. - * - * @param $new - * New presets to be created. - */ -function load_imagecache_presets_update($old = array(), $new = NULL) { - // Remove old presets. - foreach ($old as $options) { - load_imagecache_preset_delete($options); - } - - if ($new == NULL) { - load_imagecache_presets_create(); - } - else { - // Create new presets. - foreach ($new as $options) { - load_imagecache_preset_create($options); - } - } -} - -/** - * Return an array of common display resolutions. - */ -function load_imagecache_presets_load_imagecache_presets() { - return array( - array('width' => '90%', 'height' => '90%', 'operation' => 'imagecache_scale', 'name' => '0.90x0.90'), - array('width' => '80%', 'height' => '80%', 'operation' => 'imagecache_scale', 'name' => '0.80x0.80'), - array('width' => '70%', 'height' => '70%', 'operation' => 'imagecache_scale', 'name' => '0.70x0.70'), - array('width' => '60%', 'height' => '60%', 'operation' => 'imagecache_scale', 'name' => '0.60x0.60'), - array('width' => '50%', 'height' => '50%', 'operation' => 'imagecache_scale', 'name' => '0.50x0.50'), - array('width' => '40%', 'height' => '40%', 'operation' => 'imagecache_scale', 'name' => '0.40x0.40'), - array('width' => '30%', 'height' => '30%', 'operation' => 'imagecache_scale', 'name' => '0.30x0.30'), - array('width' => '20%', 'height' => '20%', 'operation' => 'imagecache_scale', 'name' => '0.20x0.20'), - array('width' => '10%', 'height' => '10%', 'operation' => 'imagecache_scale', 'name' => '0.10x0.10'), - array('width' => '95%', 'height' => '95%', 'operation' => 'imagecache_scale', 'name' => '0.95x0.95'), - array('width' => '85%', 'height' => '85%', 'operation' => 'imagecache_scale', 'name' => '0.85x0.85'), - array('width' => '75%', 'height' => '75%', 'operation' => 'imagecache_scale', 'name' => '0.75x0.75'), - array('width' => '65%', 'height' => '65%', 'operation' => 'imagecache_scale', 'name' => '0.65x0.65'), - array('width' => '55%', 'height' => '55%', 'operation' => 'imagecache_scale', 'name' => '0.55x0.55'), - array('width' => '45%', 'height' => '45%', 'operation' => 'imagecache_scale', 'name' => '0.45x0.45'), - array('width' => '35%', 'height' => '35%', 'operation' => 'imagecache_scale', 'name' => '0.35x0.35'), - array('width' => '25%', 'height' => '25%', 'operation' => 'imagecache_scale', 'name' => '0.25x0.25'), - array('width' => '15%', 'height' => '15%', 'operation' => 'imagecache_scale', 'name' => '0.15x0.15'), - array('width' => '5%', 'height' => '5%', 'operation' => 'imagecache_scale', 'name' => '0.05x0.05'), - ); -} -- cgit v1.2.3