function _imagecache_keyword_filter in ImageCache 5.2
Same name and namespace in other branches
- 5 imagecache.module \_imagecache_keyword_filter()
- 6.2 imagecache.module \_imagecache_keyword_filter()
Accept a keyword (center, top, left, etc) and return it as an offset in pixels.
1 call to _imagecache_keyword_filter()
- _imagecache_filter in ./
imagecache.module - Filter key word values such as 'top', 'right', 'center', and also percentages. All returned values are in pixels relative to the passed in height and width.
File
- ./
imagecache.module, line 645 - Dynamic image resizer and image cacher.
Code
function _imagecache_keyword_filter($value, $current_pixels, $new_pixels) {
switch ($value) {
case 'top':
case 'left':
$value = 0;
break;
case 'bottom':
case 'right':
$value = $current_pixels - $new_pixels;
break;
case 'center':
$value = $current_pixels / 2 - $new_pixels / 2;
break;
}
return $value;
}