1 image.module image_filter_keyword($value, $current_pixels, $new_pixels)

Accept a keyword (center, top, left, etc) and return it as a pixel offset.

Parameters

$value:

$current_pixels:

$new_pixels:

Return value

int:

File

core/modules/image/image.module, line 1341
Exposes global functionality for creating image styles.

Code

function image_filter_keyword($value, $current_pixels, $new_pixels) {
  switch ($value) {
    case 'top':
    case 'left':
      return 0;

    case 'bottom':
    case 'right':
      return (int) round($current_pixels - $new_pixels);

    case 'center':
      return (int) round($current_pixels / 2 - $new_pixels / 2);
  }
  return (int) $value;
}