You are here

function _imagecache_filter in ImageCache 5

Same name and namespace in other branches
  1. 5.2 imagecache.module \_imagecache_filter()

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.

1 call to _imagecache_filter()
imagecache_cache in ./imagecache.module

File

./imagecache.module, line 323
Dynamic image resizer and image cacher.

Code

function _imagecache_filter($key, $value, $current_width, $current_height, $new_width = NULL, $new_height = NULL) {
  switch ($key) {
    case 'width':
      $value = _imagecache_percent_filter($value, $current_width);
      break;
    case 'height':
      $value = _imagecache_percent_filter($value, $current_height);
      break;
    case 'xoffset':
      $value = _imagecache_keyword_filter($value, $current_width, $new_width);
      break;
    case 'yoffset':
      $value = _imagecache_keyword_filter($value, $current_height, $new_height);
      break;
  }
  return $value;
}