Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RotateImageEffect.php

function RotateImageEffect::transformDimensions

Overrides ImageEffectBase::transformDimensions

File

core/modules/image/src/Plugin/ImageEffect/RotateImageEffect.php, line 42

Class

RotateImageEffect
Rotates an image resource.

Namespace

Drupal\image\Plugin\ImageEffect

Code

public function transformDimensions(array &$dimensions, $uri) {
    // If the rotate is not random and current dimensions are set,
    // then the new dimensions can be determined.
    if (!$this->configuration['random'] && $dimensions['width'] && $dimensions['height']) {
        $rect = new Rectangle($dimensions['width'], $dimensions['height']);
        $rect = $rect->rotate($this->configuration['degrees']);
        $dimensions['width'] = $rect->getBoundingWidth();
        $dimensions['height'] = $rect->getBoundingHeight();
    }
    else {
        $dimensions['width'] = $dimensions['height'] = NULL;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal