file_validate_is_image example

'Only files with the following extensions are allowed: <em class="placeholder">exe txt</em>.',
        ],
      ],
    ];
  }

  /** * This ensures a specific file is actually an image. */
  public function testFileValidateIsImage() {
    $this->assertFileExists($this->image->getFileUri());
    $errors = file_validate_is_image($this->image);
    $this->assertCount(0, $errors, 'No error reported for our image file.');

    $this->assertFileExists($this->nonImage->getFileUri());
    $errors = file_validate_is_image($this->nonImage);
    $this->assertCount(1, $errors, 'An error reported for our non-image file.');
  }

  /** * This ensures the resolution of a specific file is within bounds. * * The image will be resized if it's too large. */
Home | Imprint | This part of the site doesn't use cookies.