You are here

public function Resize::opResize in IMCE 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/ImcePlugin/Resize.php \Drupal\imce\Plugin\ImcePlugin\Resize::opResize()

Operation handler: resize.

File

src/Plugin/ImcePlugin/Resize.php, line 44

Class

Resize
Defines Imce Resize plugin.

Namespace

Drupal\imce\Plugin\ImcePlugin

Code

public function opResize(ImceFM $fm) {
  $width = min(10000, (int) $fm
    ->getPost('width'));
  $height = min(10000, (int) $fm
    ->getPost('height'));
  $copy = (bool) $fm
    ->getPost('copy');
  $items = $fm
    ->getSelection();
  if ($this
    ->validateResize($fm, $items, $width, $height, $copy)) {
    $this
      ->resizeItems($fm, $items, $width, $height, $copy);
  }
}