You are here

function _imagecache_percent_filter in ImageCache 5.2

Same name and namespace in other branches
  1. 5 imagecache.module \_imagecache_percent_filter()
  2. 6.2 imagecache.module \_imagecache_percent_filter()

Accept a percentage and return it in pixels.

1 call to _imagecache_percent_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 635
Dynamic image resizer and image cacher.

Code

function _imagecache_percent_filter($value, $current_pixels) {
  if (strpos($value, '%') !== false) {
    $value = str_replace('%', '', $value) * 0.01 * $current_pixels;
  }
  return $value;
}