aboutsummaryrefslogtreecommitdiff
path: root/load_imagecache_presets.module
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2011-04-20 11:20:25 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-04-20 11:20:25 -0300
commitd79e3b775b544fe3656d566b4b3148a0b6a1d398 (patch)
tree05a96baa9801a6f34068f38c98f18b9c65856bb6 /load_imagecache_presets.module
parent0b097f3d27109b1b6f52c4d21889f1d370006a22 (diff)
downloadimagecache_auto-d79e3b775b544fe3656d566b4b3148a0b6a1d398.tar.gz
imagecache_auto-d79e3b775b544fe3656d566b4b3148a0b6a1d398.tar.bz2
Renaming module (1)
Diffstat (limited to 'load_imagecache_presets.module')
-rw-r--r--load_imagecache_presets.module135
1 files changed, 0 insertions, 135 deletions
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 @@
-<?php
-// $Id$
-
-/**
- * @file
- * ImageCache functions.
- */
-
-/**
- * Create ImageCache profiles for common display resolutions.
- */
-function load_imagecache_presets_create() {
- $presets = module_invoke_all('load_imagecache_presets');
- foreach ($presets as $options) {
- load_imagecache_preset_create($options);
- }
-}
-
-/**
- * Create an ImageCache preset.
- *
- * @param $options
- * Preset options.
- *
- * @see http://drupal.org/node/558664
- */
-function load_imagecache_preset_create($options) {
- // Set preset name
- if (isset($options['name'])) {
- $name = $options['name'];
- }
- else {
- $name = $options['width'] .'x'. $options['height'];
- }
-
- // Check if preset already exists.
- $preset = imagecache_preset_by_name($name);
- if (!empty($preset)) {
- return;
- }
-
- // Create a preset.
- $preset = imagecache_preset_save(array('presetname' => $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'),
- );
-}