Convert HEIC Images to JPEG in PHP

Packages

April 13th, 2023

Convert HEIC Images to JPEG in PHP

The php-heic-to-jpg PHP package is the easiest way to convert HEIC (High-Efficiency Image Container) images to JPEG with PHP and Laravel framework.

Using this package doesn't require any PHP libraries or external dependencies to be installed. The package works by using a binary file created with Golang that ships with this package. The package does the file conversions, and you get a simple interface to go from HEIC or JPEG:

use Maestroerror\HeicToJpg;
 
// Save the HEIC file as a JPEG
HeicToJpg::convert("image1.heic")->saveAs("image1.jpg");
 
// Get the content (binary) of the converted file:
HeicToJpg::convert("image1.heic")->get();

This package also provides a convenience method to check if a file is a HEIC file:

use Maestroerror\HeicToJpg;
 
if (HeicToJpg::isHeic("image.heic")) {
// Your code
}

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.