phacility/phabricator · error · Exception

This file is not a viewable image.

Error message

This file is not a viewable image.

What it means

Fires in updateDimensions when the file's MIME type is not one Phabricator treats as a browser-viewable image (isViewableImage() returned false). The method needs to load the bitmap to read its dimensions, so calling it on non-image data (or a format the image pipeline rejects) aborts before GD is invoked.

Solutions

  1. Only call updateDimensions() for files passing isViewableImage()
  2. Check the file's MIME type detection if the file really is an image
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/applications/files/storage/PhabricatorFile.php:1098 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/e8dbf785c2c696b0. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/files/storage/PhabricatorFile.php:1098

  public function getStorageProperty($key, $default = null) {
    $properties = $this->getStorageProperties();
    return idx($properties, $key, $default);
  }

  public function loadDataFromIterator($iterator) {
    $result = '';

    foreach ($iterator as $chunk) {
      $result .= $chunk;
    }

    return $result;
  }

  public function updateDimensions($save = true) {
    if (!$this->isViewableImage()) {
      throw new Exception(pht('This file is not a viewable image.'));
    }

    if (!function_exists('imagecreatefromstring')) {
      throw new Exception(pht('Cannot retrieve image information.'));
    }

    if ($this->getIsChunk()) {
      throw new Exception(
        pht('Refusing to assess image dimensions of file chunk.'));
    }

    $engine = $this->instantiateStorageEngine();
    if ($engine->isChunkEngine()) {
      throw new Exception(
        pht('Refusing to assess image dimensions of chunked file.'));
    }

    $data = $this->loadFileData();

View on GitHub (pinned to 5720a38cfe)