Verified Commit f7a7eba4 authored by Jess's avatar Jess
Browse files

Issue #1215784 by Saphyel, jenlampton, penyaskito, jlscott, simohell,...

Issue #1215784 by Saphyel, jenlampton, penyaskito, jlscott, simohell, sanjusci, StephaneQ, jeffschuler, scresante, droplet, Shivam Agarwal, xjm, jbrown, alexpott, quicksketch, Gábor Hojtsy, smustgrave, ianthomas_uk, TR, bleen, nlisgo, catch: Terminology update: don't say "Resolution" when we mean "Dimensions"

(cherry picked from commit df6c4b70)
parent 5cde7938
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -319,9 +319,9 @@ public function paragraphs($paragraph_count = 12) {
   * @param string $destination
   *   The absolute file path where the image should be stored.
   * @param string $min_resolution
   *   The minimum resolution for the image. For example, '400x300'.
   *   The minimum dimensions for the image. For example, '400x300'.
   * @param string $max_resolution
   *   The maximum resolution for the image. For example, '800x600'.
   *   The maximum dimensions for the image. For example, '800x600'.
   *
   * @return string
   *   Path to image file.
+3 −3
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public function testFileValidateIsImage() {
  }

  /**
   * This ensures the resolution of a specific file is within bounds.
   * This ensures the dimensions of a specific file is within bounds.
   *
   * The image will be resized if it's too large.
   */
@@ -166,11 +166,11 @@ public function testFileValidateImageResolution() {
    $errors = file_validate_image_resolution($this->nonImage);
    $this->assertCount(0, $errors, 'Should not get any errors for a non-image file.');
    $errors = file_validate_image_resolution($this->nonImage, '50x50', '100x100');
    $this->assertCount(0, $errors, 'Do not check the resolution on non files.');
    $this->assertCount(0, $errors, 'Do not check the dimensions on non files.');

    // Minimum size.
    $errors = file_validate_image_resolution($this->image);
    $this->assertCount(0, $errors, 'No errors for an image when there is no minimum or maximum resolution.');
    $this->assertCount(0, $errors, 'No errors for an image when there is no minimum or maximum dimensions.');
    $errors = file_validate_image_resolution($this->image, 0, '200x1');
    $this->assertCount(1, $errors, 'Got an error for an image that was not wide enough.');
    $errors = file_validate_image_resolution($this->image, 0, '1x200');
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ protected function setUp(): void {
  }

  /**
   * This ensures the resolution of a specific file is within bounds.
   * This ensures the dimensions of a specific file is within bounds.
   *
   * The image will be resized if it's too large.
   *
@@ -66,7 +66,7 @@ public function testFileValidateImageResolution() {
      ],
    ];
    $violations = $this->validator->validate($this->nonImage, $validators);
    $this->assertCount(0, $violations, 'Do not check the resolution on non files.');
    $this->assertCount(0, $violations, 'Do not check the dimensions on non files.');

    // Minimum size.
    $validators = ['FileImageDimensions' => []];
+2 −2
Original line number Diff line number Diff line
@@ -108,10 +108,10 @@ field.field_settings.image:
  mapping:
    max_resolution:
      type: string
      label: 'Maximum image resolution'
      label: 'Maximum image dimensions'
    min_resolution:
      type: string
      label: 'Minimum image resolution'
      label: 'Minimum image dimensions'
    alt_field:
      type: boolean
      label: 'Enable Alt field'
+2 −2
Original line number Diff line number Diff line
@@ -37,11 +37,11 @@ function image_help($route_name, RouteMatchInterface $route_match) {
      $output .= '<dt>' . t('Naming image styles') . '</dt>';
      $output .= '<dd>' . t('When you define an image style, you will need to choose a displayed name and a machine name. The displayed name is shown in administrative pages, and the machine name is used to generate the URL for accessing an image processed in that style. There are two common approaches to naming image styles: either based on the effects being applied (for example, <em>Square 85x85</em>), or based on where you plan to use it (for example, <em>Profile picture</em>).') . '</dd>';
      $output .= '<dt>' . t('Configuring image fields') . '</dt>';
      $output .= '<dd>' . t('A few of the settings for image fields are defined once when you create the field and cannot be changed later; these include the choice of public or private file storage and the number of images that can be stored in the field. The rest of the settings can be edited later; these settings include the field label, help text, allowed file extensions, image resolution restrictions, and the subdirectory in the public or private file storage where the images will be stored. The editable settings can also have different values for different entity sub-types; for instance, if your image field is used on both Page and Article content types, you can store the files in a different subdirectory for the two content types.') . '</dd>';
      $output .= '<dd>' . t('A few of the settings for image fields are defined once when you create the field and cannot be changed later; these include the choice of public or private file storage and the number of images that can be stored in the field. The rest of the settings can be edited later; these settings include the field label, help text, allowed file extensions, image dimensions restrictions, and the subdirectory in the public or private file storage where the images will be stored. The editable settings can also have different values for different entity sub-types; for instance, if your image field is used on both Page and Article content types, you can store the files in a different subdirectory for the two content types.') . '</dd>';
      $output .= '<dd>' . t('For accessibility and search engine optimization, all images that convey meaning on websites should have alternate text. Drupal also allows entry of title text for images, but it can lead to confusion for screen reader users and its use is not recommended. Image fields can be configured so that alternate and title text fields are enabled or disabled; if enabled, the fields can be set to be required. The recommended setting is to enable and require alternate text and disable title text.') . '</dd>';
      $output .= '<dd>' . t('When you create an image field, you will need to choose whether the uploaded images will be stored in the public or private file directory defined in your settings.php file and shown on the <a href=":file-system">File system page</a>. This choice cannot be changed later. You can also configure your field to store files in a subdirectory of the public or private directory; this setting can be changed later and can be different for each entity sub-type using the field. For more information on file storage, see the <a href=":system-help">System module help page</a>.', [':file-system' => Url::fromRoute('system.file_system_settings')->toString(), ':system-help' => Url::fromRoute('help.page', ['name' => 'system'])->toString()]) . '</dd>';
      $output .= '<dd>' . t('The maximum file size that can be uploaded is limited by PHP settings of the server, but you can restrict it further by configuring a <em>Maximum upload size</em> in the field settings (this setting can be changed later). The maximum file size, either from PHP server settings or field configuration, is automatically displayed to users in the help text of the image field.') . '</dd>';
      $output .= '<dd>' . t('You can also configure a minimum and/or maximum resolution for uploaded images. Images that are too small will be rejected. Images that are to large will be resized. During the resizing the <a href="http://wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image will be lost.') . '</dd>';
      $output .= '<dd>' . t('You can also configure a minimum and/or maximum dimensions for uploaded images. Images that are too small will be rejected. Images that are to large will be resized. During the resizing the <a href="http://wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in the image will be lost.') . '</dd>';
      $output .= '<dd>' . t('You can also configure a default image that will be used if no image is uploaded in an image field. This default can be defined for all instances of the field in the field storage settings when you create a field, and the setting can be overridden for each entity sub-type that uses the field.') . '</dd>';
      $output .= '<dt>' . t('Configuring displays and form displays') . '</dt>';
      $output .= '<dd>' . t('On the <em>Manage display</em> page, you can choose the image formatter, which determines the image style used to display the image in each display mode and whether or not to display the image as a link. On the <em>Manage form display</em> page, you can configure the image upload widget, including setting the preview image style shown on the entity edit form.') . '</dd>';
Loading