php / php/php-src

Unable to use getimagesize on HEIC/HEIF images

Đang mở
#20,863 13 bình luận 2 reaction 1 người được giao Xem trên GitHub

@iliaal đang làm issue này rồi.

Từ ngày 26/6/2026.

Bug Extension: gd Status: Needs Triage
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

I downloaded the heic from the pull request https://github.com/php/php-src/pull/18940, and that one does work, but none of the sample images I downloaded from https://heic.digital/samples/ work.

The following code:

<?php

$dir = __DIR__;

$allowedExt = ['jpg', 'jpeg', 'heic', 'heif'];

foreach (new DirectoryIterator($dir) as $file) {
    if ($file->isDot() || !$file->isFile()) {
        continue;
    }
    
    $ext = strtolower($file->getExtension());
    if (!in_array($ext, $allowedExt, true)) {
        continue;
    }
    
    $path = $file->getPathname();
    $info = getimagesize($path);
    
    if ($info === false) {
        echo "Failed: $path\n";
        continue;
    }
    
    [$width, $height] = $info;
    echo "$path => {$width}x$height\n";
}

Resulted in this output:

Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/soundboard.heic
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/shelf-christmas-decoration.heic
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/test4pix.heic => 54x84
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/sewing-threads.heic
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/chef-with-trumpet.heic
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/childrens-show-theater.heic
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/classic-car.heic
Failed: /Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/greyhounds-looking-for-a-table.heic

But I expected this output instead:

/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/soundboard.heic => 4000x3000
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/shelf-christmas-decoration.heic => 4000x3000
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/test4pix.heic => 54x84
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/sewing-threads.heic => 4000x3000
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/chef-with-trumpet.heic => 4032x3024
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/converted.jpeg => 8736x5856
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/childrens-show-theater.heic => 4032x3024
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/classic-car.heic => 3024x4032
/Users/earthiverse/Sites/media-store/tests/Codeception/Support/Data/images/heif/greyhounds-looking-for-a-table.heic => 3024x4032
PHP Version
PHP 8.5.1 (cli) (built: Dec 16 2025 15:59:07) (NTS)
Copyright (c) The PHP Group
Built by Shivam Mathur
Zend Engine v4.5.1, Copyright (c) Zend Technologies
    with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
    with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies
Operating System

MacOS Tahoe 26.2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.