craftcms / craftcms/cms

imageSizeByStream return 0 for TIFF image - Index Asset S3 Image

Open
#7,212 3 comments 1 reaction 1 assignee View on GitHub

@andris-sevcenko is already working on this.

Since Dec 1, 2020.

bug severity:minor
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

I'm trying to index some TIFF assets from S3.
The problem is that the width and height always return 0.

From my understanding, the function imageSizeByStream (src/helpers/Image.php:210) should return the width and height of the stream but it only works for JPG, PNG, and GIF. The issue starts here: src/services/AssetIndexer.php:552 where the indexer tries to get the width and height of the image from a stream but get [0, 0] back.

I got ~125k TIFF to index, that's why I don't want to cache them locally.

So we may need to add support for other image formats inside imageSizeByStream (TIFF, WEBP, etc)

Steps to reproduce
  1. Connect to a S3 bucket
  2. Add some TIFF Images in the bucket
  3. Index them without cache (--cache-remote-images=0)
  4. The dimensions will be 0 and save as NULL inside the database.
Additional info
  • Craft version: 3.5.12.1
  • PHP version: 7.3.8
  • Database driver & version:
  • Plugins & versions:
    Craft CMS S3 - 1.2.11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.