HEIF/HEIC support is coming in PHP 8.5

57 views
Skip to first unread message

Adrian London

unread,
Oct 1, 2025, 7:42:17 AM10/1/25
to Gallery 3 Users
From what I've read, the "getimagesize" command will support HEIC files from PHP 8.5 onwards.  This is due for release around November.

Most iPhones take photos in HEIC now, although a simple setting will change this back to jpeg.  HEIC is much more modern and has a better compression algorithm, so I'd prefer to use it.

The getimagesize command is used heavily in Gallery3 for determining the file type before most processing involving photos.  It's also used by the "exif" module for extracting the metadata (IPTC in block APP13).  I title/describe all my photos prior to uploading, so find the exif module very useful.

At the moment, I export all my photos from my phone in jpeg format so that G3 can upload them. 

Another change is that HEIC files don't support IPTC but instead use  XMP for storing metadata.  I've managed to edit the "exif" module to read XMP so I'm ready for the future :). The only downside is that G3 can write IPTC tags but not XMP ones, although that could potentially be coded too.

I doubt many people care about HEIC and XMP support.  However, I do, hence this post!

-- 
Adrian


Gwyneth Llewelyn

unread,
Jan 2, 2026, 3:32:07 PM (9 days ago) Jan 2
to Gallery 3 Users
Hear, hear!

That's good news indeed. A small correction: iPhones have supported HEIC since iOS 11 in September 2017; it's now the default format. You can save them to JPEG if you really wish to do so.

It's actually amazing how long the 'standard' image web formats — GIF, JPEG, PNG — have been around. They're utterly outdated in all possible regards, except, well, for compatibility's sake. Even JPEG2000 — which was briefly used by cameras before RAW (and now HEIC/AVIF...) became 'universal' and is still used in medical imaging, as well as some oddities such as the virtual world Second Life — which was a step towards improving JPEG dramatically is considered 'deprecated' — it is, after all, a quarter of a century old. HEIC and AVIF are orders of magnitude better than JPEG (and even JPEG2000) in all possible regards. Even WebP is far better than JPEG — that's why Google used it — and if it weren't for being built into the Chromium browsers (the other engines quickly following up), and heavily promoted by Google since it was launched... that format is now considered 'obsolete' by Google itself! 😳

That said, I've been a long-time fan of Flickr — except that they have been adamant in sticking with GIF, JPEG & PNG and utterly refuse to use anything else. As a consequence, they have limited the file sizes, the number of images stored, as well as the picture dimensions, in order to keep their storage costs manageable. That is incredibly stupid. All they ought to do is to run Tinify on all their existing images, converting them to AVIF (Tinify can read HEIC but only save to AVIF — probably because of licensing issues), and they'd save, oh, perhaps 80–90% of disk space. It's amazing how efficient these new formats are. And it's amazing how a company like Flickr hasn't realised yet that they're shooting their own feet (with a machine gun). Even if they don't use the ultra-super-duper-compression technology by Tinify (it comes with a price tag, after all), they could certainly use ImageMagick, which does a very reasonable conversion-with-compression (if you're fond of tinkering a lot with ImageMagick, instead of going with the plain defaults, you can come very close to the compression levels achieved by Tinify — it just takes time, patience, lots of experimenting, and reading the encyclopedic manual of ImageMagick to explore the wide range of options and possibilities there).

As soon as Gallery3 supports any of the new formats, I'll be happily converting all the images in my Gallery — goodbye, old, space-eating images (and bandwidth-consuming!), hello new world, where everything is smaller and downloads faster!

Alas, it also means that Gallery3 must fully support PHP 8.5. Because of potentially outstanding compatibility issues, I'm still using version 3.1.5 under PHP 7.4. I really shouldn't do that (security issues, obsolete PHP version, etc., etc., not to mention that the new engine driving PHP 8.X is even better than the already souped-up version done for PHP 7.X).

On the other hand, the IPTC/XMP/EXIF issue might be a problem. I'm spoilt: I tend to have tools that extract 'whatever tags are present' and not worry too much if the file format X supports tagging Y. I think that, again, ImageMagick can come to the rescue in several cases, as it can convert metadata to some extent (I use that feature every now and then, but I'm not sure how much gets converted and how much gets lost in the process).

Of course, this would be one of those things worth a plugin... if anyone was still developing plugins for Gallery3... lol

Cheers, and thanks for the 'news' (three months later, that is!)

   — Gwyn

Adrian London

unread,
Jan 2, 2026, 3:41:54 PM (9 days ago) Jan 2
to Gallery 3 Users
PHP 8.5 is now released, but my hosting provider will no doubt take a few months before my shared host is upgraded.

I currently run G3 on PHP 8.3 without issue, so I don't expect major issues with the PHP upgrade.

As for IPTC/XMP - same as you; I can use either as I manipulate my photos' metadata using exiftool before importing.  However, I've added functionality to G3 which will read IPTC and XMP as required. 

-- 
Adrian


Adrian London

unread,
Jan 11, 2026, 12:55:35 PM (13 hours ago) Jan 11
to Gallery 3 Users
On a cold day, and wanting to keep my brain working, I decided to do the following:

- Take a 12 year old Macbook with a smashed screen and find a use for it
- Install LAMP (Ubuntu v24, Apache2, MySQL, PHP 8.5)
- Copy over my database, G3 installation and photos from my hosting provider

I managed to get it all working, so not only do I have a safe, sandbox copy of gallery3 to play with, but I can now say it works fine on PHP 8.5.

However, getting it to read HEIC files is going to take some time due to all the places that mime types seem to be checked and hard-coded within G3.  It might not even be possible, but I'm ready for the fight!

-- 
Adrian

Reply all
Reply to author
Forward
0 new messages