1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
define("CACHE_HASH_LENGTH", strlen(sha1(HASH_SEED)) + 1);
function getImageProcessorURIFromCacheName($match, $watermarks) { $args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); $set = array(); $done = false; $params = explode('_', stripSuffix($match)); while (!$done && count($params) > 1) { $check = array_pop($params); if (is_numeric($check)) { $set['s'] = $check; break; } else { $c = substr($check, 0, 1); if ($c == 'w' || $c == 'h') { $v = (int) substr($check, 1); if ($v) { $set[$c] = $v; continue; } } if ($c == 'c') { $c = substr($check, 0, 2); $v = (int) substr($check, 2); if ($v) { $set[$c] = $v; continue; } } if (!isset($set['w']) && !isset($set['h']) && !isset($set['s'])) { if (!isset($set['wm']) && in_array($check, $watermarks)) { $set['wm'] = $check; } else if ($check == 'thumb') { $set['t'] = true; } else { $set['effects'] = $check; } } else { array_push($params, $check); break; } } } $image = preg_replace('~.*/' . CACHEFOLDER . '/~', '', implode('_', $params)) . '.' . getSuffix($match); if (getOption('obfuscate_cache')) { $image = dirname($image) . '/' . substr(basename($image), CACHE_HASH_LENGTH); } return array($image, getImageArgs($set)); }
?>
|