code: public function transformDimensions(array &$dimensions, $uri) {
      if (!isset($dimensions['width']) || !isset($dimensions['height'])) {
        // We cannot know which preset would be executed and thus cannot know the
        // resulting dimensions, unless both styles return the same dimensions:
        $landscape_dimensions = $portrait_dimensions = $dimensions;
  
        /* @var ImageStyle $landscape_style */
        $landscape_style = ImageStyle::load($this->configuration['landscape']);
        $landscape_style->transformDimensions($landscape_dimensions, $uri);
  
        /* @var ImageStyle $portrait_style */
        $portrait_style = ImageStyle::load($this->configuration['portrait']);
        $portrait_style->transformDimensions($portrait_dimensions, $uri);
  
        if ($landscape_dimensions == $portrait_dimensions) {
          $dimensions = $landscape_dimensions;
        }
        else {
          $dimensions['width'] = $dimensions['height'] = NULL;
        }
      }
      else {
        $ratio_adjustment = isset($this->configuration['ratio_adjustment']) ? floatval($this->configuration['ratio_adjustment']) : 1;
        $aspect = $dimensions['width'] / $dimensions['height'];
        $style_name = (($aspect * $ratio_adjustment) > 1) ? $this->configuration['landscape'] : $this->configuration['portrait'];
  
        /* @var ImageStyle $style */
        $style = ImageStyle::load($style_name);
        $style->transformDimensions($dimensions, $uri);
      }
    }
docs: {@inheritdoc}