HEIC Image Validation &amp; Conversion in Laravel 13.24 | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com) [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles  ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Validate and Convert HEIC Images in Laravel 13.24        On this page       1. [  HEIC Image Support Lands in Laravel 13.24 ](#heic-image-support-lands-in-laravel-1324)
2. [  Server Requirements ](#server-requirements)
3. [  Validating HEIC Uploads ](#validating-heic-uploads)
4. [  Converting on Upload ](#converting-on-upload)
5. [  Serving AVIF With a WebP Fallback ](#serving-avif-with-a-webp-fallback)
6. [  Writing HEIC Output ](#writing-heic-output)
7. [  Error Handling ](#error-handling)
8. [  Key Takeaways ](#key-takeaways)

  ![Validate and Convert HEIC Images in Laravel 13.24](https://cdn.msaied.com/522/ce578f30aaaf73de76c9f681d9fd27bd.png)

 [  Laravel ](https://www.msaied.com/articles?category=laravel) [  PHP ](https://www.msaied.com/articles?category=php)  #Laravel   #HEIC   #Image Processing   #Imagick   #AVIF   #WebP  

 Validate and Convert HEIC Images in Laravel 13.24 
===================================================

     5 Aug 2026      4 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   HEIC Image Support Lands in Laravel 13.24  ](#heic-image-support-lands-in-laravel-1324)
2. [  02   Server Requirements  ](#server-requirements)
3. [  03   Validating HEIC Uploads  ](#validating-heic-uploads)
4. [  04   Converting on Upload  ](#converting-on-upload)
5. [  05   Serving AVIF With a WebP Fallback  ](#serving-avif-with-a-webp-fallback)
6. [  06   Writing HEIC Output  ](#writing-heic-output)
7. [  07   Error Handling  ](#error-handling)
8. [  08   Key Takeaways  ](#key-takeaways)

 HEIC Image Support Lands in Laravel 13.24
-----------------------------------------

Every iPhone sold in the last several years captures photos in HEIC by default — a format roughly half the size of an equivalent JPEG. The catch: Chrome and Firefox cannot render it. Until Laravel 13.24, HEIC files were rejected before they even reached the image driver. That changes now.

Laravel 13.24 extends the `image` validation rule to accept `heic`, `heif`, and `avif`, adds a `toHeic()` output method, and wires everything through the existing image API.

Server Requirements
-------------------

PHP cannot decode HEIC on its own. You need the **Imagick extension** with ImageMagick's HEIF delegate compiled in (built on `libheif`). The GD driver cannot read HEIC at all.

Verify your delegate is present before deploying:

```bash
php -r "print_r(Imagick::queryFormats('HEI*'));"

```

An empty array means the delegate is missing. On Debian/Ubuntu install `libheif1`; on macOS the Homebrew `imagemagick` formula includes it. AVIF is more forgiving — GD can decode it when PHP was built against `libavif`.

Install Intervention Image if you have not already:

```bash
composer require intervention/image:^4.0

```

Validating HEIC Uploads
-----------------------

The `image` rule now recognises `heic`, `heif`, and `avif` with no extra configuration:

```php
$request->validate([
    'photo' => ['required', 'image', 'max:12288'],
]);

```

To be explicit about accepted formats, use the `mimes` rule:

```php
'photo' => ['required', 'mimes:jpg,png,webp,heic', 'max:12288'],

```

Both rules resolve the type from file contents rather than trusting the browser-supplied MIME type, so `image/heic` and `image/heif` variants are handled consistently.

Converting on Upload
--------------------

Storing a HEIC file as-is means broken images for most visitors. Convert during the upload request:

```php
$path = $request->image('photo')
    ->usingImagick()
    ->orient()
    ->scale(width: 2000)
    ->toWebp()
    ->quality(80)
    ->store('photos');

```

Two details matter here:

- `usingImagick()` is required — the default GD driver cannot read HEIC.
- `orient()` reads EXIF rotation metadata and corrects it, which is critical for portrait phone shots stored as landscape frames with a rotation flag.

The stored filename gets the correct extension automatically: a HEIC input converted to WebP is saved as `photos/{hash}.webp`.

Serving AVIF With a WebP Fallback
---------------------------------

AVIF is typically 20–30% smaller than WebP at comparable quality. Generate both variants from one source and let the browser choose:

```php
$source = $request->image('photo')->usingImagick()->orient()->scale(width: 2000);

$avif = $source->toAvif()->quality(70)->storeAs('photos', "{$id}.avif");
$webp = $source->toWebp()->quality(80)->storeAs('photos', "{$id}.webp");

```

```xml

    id}.avif") }}" type="image/avif">
    id}.webp") }}" alt="{{ $photo->caption }}">

```

AVIF encoding is slower than WebP, so if uploads are synchronous this is a good candidate for a queued job.

Writing HEIC Output
-------------------

Output to HEIC is also supported via `toHeic()`:

```php
Image::fromPath(storage_path('app/photo.jpg'))
    ->usingImagick()
    ->toHeic()
    ->quality(80)
    ->store('photos');

```

The `heif` alias is normalised to `heic` throughout — `optimize('heif')` produces the same output, files are stored with the `.heic` extension, and `mimeType()` reports `image/heic`.

Error Handling
--------------

If a file reaches the driver in an unsupported format, an `ImageException` is thrown:

```css
The image format [image/tiff] is not supported.

```

This same exception surfaces when a HEIC file hits an Imagick build without the HEIF delegate — a deployment issue, not a user error. Validate the delegate on the server as part of your release checklist.

Key Takeaways
-------------

- Laravel 13.24 adds `heic`, `heif`, and `avif` to the `image` validation rule — no configuration needed.
- HEIC decoding requires Imagick with the HEIF delegate; GD cannot handle it.
- Always call `usingImagick()` and `orient()` when processing phone photos.
- Generate AVIF + WebP variants and use `` for optimal browser delivery.
- `toHeic()` enables HEIC output for Apple-device pipelines and archives.
- A missing HEIF delegate throws `ImageException` — check it at deploy time.

---

*Source: [Validate and Convert HEIC Images in Laravel — Laravel News](https://laravel-news.com/laravel-heic-image-uploads)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Fvalidate-and-convert-heic-images-in-laravel-1324&text=Validate+and+Convert+HEIC+Images+in+Laravel+13.24) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Fvalidate-and-convert-heic-images-in-laravel-1324) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Why does HEIC validation fail even after upgrading to Laravel 13.24?        The most common cause is a missing HEIF delegate in your ImageMagick build. Run `php -r "print_r(Imagick::queryFormats('HEI*'));"` on your server. An empty array means the delegate is not compiled in. On Debian/Ubuntu, install `libheif1`; on macOS, reinstall ImageMagick via Homebrew. The GD driver cannot read HEIC regardless of Laravel version. 

      Q02  Do I need to call usingImagick() explicitly when processing HEIC uploads?        Yes. Laravel's image API defaults to the GD driver, which cannot decode HEIC files. You must chain `-&gt;usingImagick()` before any transformation on a HEIC input, otherwise the operation will fail. 

      Q03  What is the difference between using the image rule and the mimes rule for HEIC uploads?        Both rules resolve the file type from its contents rather than the browser-supplied MIME type, so both handle the `image/heic` and `image/heif` variants correctly. The `image` rule is the simpler option and now includes HEIC, HEIF, and AVIF automatically. The `mimes` rule is useful when you want to explicitly whitelist a specific set of formats. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://www.msaied.com/articles) 

 [ ![Saga Lara Flow: Durable Workflows and Compensating Transactions on Laravel Queues](https://cdn.msaied.com/520/d77bd3c0cecb6fb89c16f85648e7e369.png) Laravel Workflows Saga Pattern 

### Saga Lara Flow: Durable Workflows and Compensating Transactions on Laravel Queues

Saga Lara Flow is a Laravel package that lets you write long-running business processes as plain PHP methods o...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 7 Aug 2026     4 min read  

  Read    

 ](https://www.msaied.com/articles/saga-lara-flow-durable-workflows-and-compensating-transactions-on-laravel-queues) [ ![Filament v4.12 & v5.7: Major Performance Improvements and Security Patches](https://cdn.msaied.com/518/48e5a4da1b38d6cf27a0117baa547e1b.png) Filament Laravel Performance 

### Filament v4.12 &amp; v5.7: Major Performance Improvements and Security Patches

Filament v4.12.6 and v5.7.6 ship massive rendering speed gains—up to 92% faster form fields—alongside security...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 6 Aug 2026     1 min read  

  Read    

 ](https://www.msaied.com/articles/filament-v412-v57-major-performance-improvements-and-security-patches) [ ![Managed Queues: Autoscaling Queue Workers on Laravel Cloud](https://cdn.msaied.com/519/854099015015dbc72dd8743202b69efc.png) Laravel Cloud Queue Workers Autoscaling 

### Managed Queues: Autoscaling Queue Workers on Laravel Cloud

Laravel Cloud's managed queues feature autoscales workers based on queue pressure, surfaces failed jobs in a r...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 6 Aug 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/managed-queues-autoscaling-queue-workers-on-laravel-cloud) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
