You are here

protected function EditorUploadImageScaleTest::setMaxDimensions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::setMaxDimensions()

Sets the maximum dimensions and saves the configuration.

Parameters

string|int $width: The width of the image.

string|int $height: The height of the image.

1 call to EditorUploadImageScaleTest::setMaxDimensions()
EditorUploadImageScaleTest::testEditorUploadImageScale in core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
Tests scaling of inline images.

File

core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php, line 182

Class

EditorUploadImageScaleTest
Tests scaling of inline images.

Namespace

Drupal\Tests\editor\Functional

Code

protected function setMaxDimensions($width, $height) {
  $editor = Editor::load('basic_html');
  $image_upload_settings = $editor
    ->getImageUploadSettings();
  $image_upload_settings['max_dimensions']['width'] = $width;
  $image_upload_settings['max_dimensions']['height'] = $height;
  $editor
    ->setImageUploadSettings($image_upload_settings);
  $editor
    ->save();
}