MaestroError / php-heic-to-jpg

The easiest way to convert HEIC images to JPEG with PHP and Laravel framework
MIT License
143 stars 20 forks source link

convertOnMac("image1.heic", "arm64") reports error on M2 Pro Mac Mini #31

Closed jcogs-design closed 6 months ago

jcogs-design commented 10 months ago

As per title, attempt to convert on a system running on a Mac Mini with M2 Pro chip generates the following error:

 Couldn't convert HEIC to JPG: '' | Bin used: 'php-heic-to-jpg-darwin-arm64' HEIC: '/var/www/html/public_html/media/images/heic-test-image1.heic' Full Command: '/var/www/html/system/user/addons/jcogs_img/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64 "/var/www/html/public_html/media/images/heic-test-image1.heic" "/var/www/html/public_html/media/images/heic-test-image1.heic-15627136406573a99b3e1835.09497305"'

System is running Macos 17.1.2. Running latest version of this library. php 8.2

Any ideas / suggestions about what I can do to get this to work?

MaestroError commented 8 months ago

Hi @jcogs-design! Try to run "full command" and let me see the output, if needed:

/var/www/html/system/user/addons/jcogs_img/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64 "/var/www/html/public_html/media/images/heic-test-image1.heic" "/var/www/html/public_html/media/images/heic-test-image1.heic-15627136406573a99b3e1835.09497305"
vjanssens commented 8 months ago

It looks like i'm running in the same issue on my MacBook M1 Pro with Ventura 13.1:

$ ./vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64 image1.heic image1.jpeg
[1]    75044 killed     ./vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64

However, if I change the full command to use amd64 it seems to work as expected:

$ ./vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-amd64 image1.heic image1.jpeg
JPG: --image1.jpeg--
Created by MaestroError

I understand the 'killed' message isn't really helpful. What can I do to get more information? I'm running PHP 8.2.14 installed with homebrew, Laravel v10.43.0, maestroerror/heif-converter v0.2, maestroerror/php-heic-to-jpg v1.0.5.

I've tried to set the $forceArm = true parameter on the convert method, but that obviously (?) forces the use of the arm binary. Would it be possible to force the use of amd binary?

EDIT: Reading the manual helps a lot, lol. This seems to solve the issue for me: https://github.com/MaestroError/php-heic-to-jpg?tab=readme-ov-file#for-macos-users.

MaestroError commented 8 months ago

@vjanssens Happy to hear that your issue is solved 👍 keep coding! 🚀