aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imagecache_auto.inc140
-rw-r--r--imagecache_auto.info6
-rw-r--r--imagecache_auto.install50
3 files changed, 133 insertions, 63 deletions
diff --git a/imagecache_auto.inc b/imagecache_auto.inc
index e359d92..b7544b8 100644
--- a/imagecache_auto.inc
+++ b/imagecache_auto.inc
@@ -9,10 +9,10 @@
/**
* Create ImageCache profiles for common display resolutions.
*/
-function load_imagecache_presets_create() {
- $presets = module_invoke_all('load_imagecache_presets');
+function imagecache_auto_create_presets() {
+ $presets = imagecache_auto_presets();
foreach ($presets as $options) {
- load_imagecache_preset_create($options);
+ imagecache_auto_create_preset($options);
}
}
@@ -24,7 +24,7 @@ function load_imagecache_presets_create() {
*
* @see http://drupal.org/node/558664
*/
-function load_imagecache_preset_create($options) {
+function imagecache_auto_create_preset($options) {
// Set preset name
if (isset($options['name'])) {
$name = $options['name'];
@@ -65,7 +65,7 @@ function load_imagecache_preset_create($options) {
* @param $options
* Preset options.
*/
-function load_imagecache_preset_delete($options) {
+function imagecache_auto_delete_preset($options) {
// Set preset name.
if (isset($options['name'])) {
$name = $options['name'];
@@ -90,27 +90,29 @@ function load_imagecache_preset_delete($options) {
* @param $new
* New presets to be created.
*/
-function load_imagecache_presets_update($old = array(), $new = NULL) {
+function imagecache_auto_presets_update($old = array(), $new = NULL) {
// Remove old presets.
foreach ($old as $options) {
- load_imagecache_preset_delete($options);
+ imagecache_auto_delete_preset($options);
}
if ($new == NULL) {
- load_imagecache_presets_create();
+ imagecache_auto_create_presets();
}
else {
// Create new presets.
foreach ($new as $options) {
- load_imagecache_preset_create($options);
+ imagecache_auto_create_preset($options);
}
}
}
/**
* Return an array of common display resolutions.
+ *
+ * @see http://en.wikipedia.org/wiki/List_of_common_resolutions
*/
-function load_imagecache_presets_load_imagecache_presets() {
+function imagecache_auto_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'),
@@ -130,6 +132,122 @@ function load_imagecache_presets_load_imagecache_presets() {
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'),
+ array('width' => '5%', 'height' => '5%', 'operation' => 'imagecache_scale', 'name' => '0.05x0.05'),
+ array('width' => 120, 'height' => 160),
+ array('width' => 140, 'height' => 192),
+ array('width' => 160, 'height' => 120),
+ array('width' => 160, 'height' => 144),
+ array('width' => 160, 'height' => 160),
+ array('width' => 160, 'height' => 200),
+ array('width' => 160, 'height' => 240),
+ array('width' => 160, 'height' => 256),
+ array('width' => 176, 'height' => 208),
+ array('width' => 176, 'height' => 220),
+ array('width' => 208, 'height' => 208),
+ array('width' => 208, 'height' => 320),
+ array('width' => 240, 'height' => 160),
+ array('width' => 240, 'height' => 320),
+ array('width' => 240, 'height' => 376),
+ array('width' => 240, 'height' => 640),
+ array('width' => 256, 'height' => 192),
+ array('width' => 256, 'height' => 256),
+ array('width' => 280, 'height' => 192),
+ array('width' => 320, 'height' => 192),
+ array('width' => 320, 'height' => 200),
+ array('width' => 320, 'height' => 240),
+ array('width' => 320, 'height' => 256),
+ array('width' => 320, 'height' => 320),
+ array('width' => 320, 'height' => 480),
+ array('width' => 352, 'height' => 416),
+ array('width' => 400, 'height' => 240),
+ array('width' => 400, 'height' => 300),
+ array('width' => 432, 'height' => 240),
+ array('width' => 480, 'height' => 250),
+ array('width' => 480, 'height' => 272),
+ array('width' => 480, 'height' => 320),
+ array('width' => 480, 'height' => 500),
+ array('width' => 512, 'height' => 256),
+ array('width' => 512, 'height' => 342),
+ array('width' => 512, 'height' => 384),
+ array('width' => 560, 'height' => 192),
+ array('width' => 600, 'height' => 480),
+ array('width' => 640, 'height' => 200),
+ array('width' => 640, 'height' => 240),
+ array('width' => 640, 'height' => 256),
+ array('width' => 640, 'height' => 320),
+ array('width' => 640, 'height' => 350),
+ array('width' => 640, 'height' => 360),
+ array('width' => 640, 'height' => 400),
+ array('width' => 640, 'height' => 480),
+ array('width' => 640, 'height' => 512),
+ array('width' => 720, 'height' => 348),
+ array('width' => 720, 'height' => 350),
+ array('width' => 720, 'height' => 364),
+ array('width' => 720, 'height' => 480),
+ array('width' => 768, 'height' => 480),
+ array('width' => 800, 'height' => 352),
+ array('width' => 800, 'height' => 480),
+ array('width' => 800, 'height' => 600),
+ array('width' => 832, 'height' => 624),
+ array('width' => 854, 'height' => 480),
+ array('width' => 960, 'height' => 540),
+ array('width' => 960, 'height' => 640),
+ array('width' => 960, 'height' => 720),
+ array('width' => 1024, 'height' => 576),
+ array('width' => 1024, 'height' => 600),
+ array('width' => 1024, 'height' => 640),
+ array('width' => 1024, 'height' => 768),
+ array('width' => 1024, 'height' => 800),
+ array('width' => 1024, 'height' => 1024),
+ array('width' => 1120, 'height' => 832),
+ array('width' => 1152, 'height' => 720),
+ array('width' => 1152, 'height' => 768),
+ array('width' => 1152, 'height' => 864),
+ array('width' => 1152, 'height' => 900),
+ array('width' => 1280, 'height' => 720),
+ array('width' => 1280, 'height' => 768),
+ array('width' => 1280, 'height' => 800),
+ array('width' => 1280, 'height' => 854),
+ array('width' => 1280, 'height' => 960),
+ array('width' => 1280, 'height' => 1024),
+ array('width' => 1366, 'height' => 768),
+ array('width' => 1400, 'height' => 1050),
+ array('width' => 1440, 'height' => 900),
+ array('width' => 1440, 'height' => 960),
+ array('width' => 1440, 'height' => 1024),
+ array('width' => 1440, 'height' => 1080),
+ array('width' => 1600, 'height' => 768),
+ array('width' => 1600, 'height' => 900),
+ array('width' => 1600, 'height' => 1000),
+ array('width' => 1600, 'height' => 1024),
+ array('width' => 1600, 'height' => 1200),
+ array('width' => 1680, 'height' => 1050),
+ array('width' => 1792, 'height' => 1344),
+ array('width' => 1800, 'height' => 1440),
+ array('width' => 1856, 'height' => 1392),
+ array('width' => 1920, 'height' => 1080),
+ array('width' => 1920, 'height' => 1200),
+ array('width' => 1920, 'height' => 1400),
+ array('width' => 1920, 'height' => 1440),
+ array('width' => 2048, 'height' => 1152),
+ array('width' => 2048, 'height' => 1536),
+ array('width' => 2304, 'height' => 1440),
+ array('width' => 2560, 'height' => 1440),
+ array('width' => 2560, 'height' => 1600),
+ array('width' => 2560, 'height' => 1920),
+ array('width' => 2560, 'height' => 2048),
+ array('width' => 2800, 'height' => 2100),
+ array('width' => 3200, 'height' => 2048),
+ array('width' => 3200, 'height' => 2400),
+ array('width' => 3840, 'height' => 2160),
+ array('width' => 3840, 'height' => 2400),
+ array('width' => 4096, 'height' => 2304),
+ array('width' => 4096, 'height' => 3072),
+ array('width' => 5120, 'height' => 3200),
+ array('width' => 5120, 'height' => 4096),
+ array('width' => 6400, 'height' => 4096),
+ array('width' => 6400, 'height' => 4800),
+ array('width' => 7680, 'height' => 4320),
+ array('width' => 7680, 'height' => 4800),
);
}
diff --git a/imagecache_auto.info b/imagecache_auto.info
index 20ac291..3ce86e8 100644
--- a/imagecache_auto.info
+++ b/imagecache_auto.info
@@ -1,5 +1,7 @@
; $Id$
-name = "Load Image Cache Presets"
-description = "Load a Set of Presets for modules using Imagecache "
+name = ImageCache Auto
+description = Creates imagecache presets on the fly.
core = 6.x
+package = ImageCache
+version = "6.x-0.1"
dependencies[] = imagecache
diff --git a/imagecache_auto.install b/imagecache_auto.install
deleted file mode 100644
index 9c88466..0000000
--- a/imagecache_auto.install
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * Banco de Conteudos Culturais Website installation procedures.
- */
-
-/**
- * Includes.
- */
-include_once('load_imagecache_presets.module');
-
-/**
- * Implementation of hook_install().
- * Install default cck.
- */
-function load_imagecache_presets_install() {
- /**
- * The following code was replaced by using Features module.
- */
- /*
- module_load_include('inc', 'install_profile_api', 'contrib/content_copy');
- $files = file_scan_directory(drupal_get_path('module', 'bcc') .'/cck', '.*cck');
-
- foreach ($files as $file) {
- install_content_copy_import_from_file($file->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
-}