function EditorUploadImageScaleTest::getTestImageInfo

Same name in other branches
  1. 8.9.x core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::getTestImageInfo()
  2. 10 core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::getTestImageInfo()

Gets the dimensions of an uploaded image.

Parameters

string $uri: The URI of the image.

Return value

array An array containing the uploaded image's width and height.

1 call to EditorUploadImageScaleTest::getTestImageInfo()
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 166

Class

EditorUploadImageScaleTest
Tests scaling of inline images.

Namespace

Drupal\Tests\editor\Functional

Code

protected function getTestImageInfo($uri) {
    $image_file = $this->container
        ->get('image.factory')
        ->get($uri);
    return [
        (int) $image_file->getWidth(),
        (int) $image_file->getHeight(),
    ];
}

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