From 385ba95d9f725fa79ceaca506aa2586eb8a42f89 Mon Sep 17 00:00:00 2001 From: Silvio Date: Mon, 9 May 2011 14:08:47 -0300 Subject: Creating hook_imagecache_auto_presets --- imagecache_auto.inc | 146 +++------------------------------------------------- 1 file changed, 7 insertions(+), 139 deletions(-) (limited to 'imagecache_auto.inc') diff --git a/imagecache_auto.inc b/imagecache_auto.inc index 223ac01..3541ba3 100644 --- a/imagecache_auto.inc +++ b/imagecache_auto.inc @@ -108,147 +108,15 @@ function imagecache_auto_presets_update($old = array(), $new = NULL) { } /** - * Return an array of common display resolutions. + * Return an array of presets. * * @see http://en.wikipedia.org/wiki/List_of_common_resolutions */ 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'), - 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'), - 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' => 250, 'height' => 100), - 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), - ); + $presets = array(); + foreach (module_implements('imagecache_auto_presets') as $module) { + $presets = array_merge($presets, module_invoke($module, 'imagecache_auto_presets')); + } + + return $presets; } -- cgit v1.2.3