You are here

private function DefineCanvas::imagick_percent_filter in Imagick 8

Helper function to calculate width from percentage

File

src/Plugin/ImageToolkit/Operation/imagick/DefineCanvas.php, line 88

Class

DefineCanvas
Defines imagick define canvas operation.

Namespace

Drupal\imagick\Plugin\ImageToolkit\Operation\imagick

Code

private function imagick_percent_filter($length_specification, $current_length) {
  if (strpos($length_specification, '%') !== FALSE) {
    $length_specification = $current_length !== NULL ? str_replace('%', '', $length_specification) * 0.01 * $current_length : NULL;
  }
  return $length_specification;
}