function EditorUploadImageScaleTest::setMaxDimensions

Same name and namespace in other branches
  1. 8.9.x core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::setMaxDimensions()
  2. 10 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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.