27.1 C
Pakistan
Saturday, July 27, 2024

PHP Code to Convert HEIC Images to JPEG

The simplest method for converting HEIC (High-Efficiency Image Container) photos to JPEG using PHP and the Laravel framework is to use the php-heic-to-jpg PHP package.

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.

 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles