MaestroError / php-heic-to-jpg

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

Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: #9

Closed yuanxin32323 closed 1 year ago

yuanxin32323 commented 1 year ago

I have encountered this situation as well. I am dealing with a local file, and the following is the error message.

Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: '/www/wwwroot/www.mishejia.com/public/uploads/image/20230327/6e09410efcc200d2ab6f99ce705c86a7.HEIC' Full Command: '/www/wwwroot/www.mishejia.com/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/www/wwwroot/www.mishejia.com/public/uploads/image/20230327/6e09410efcc200d2ab6f99ce705c86a7.HEIC" "/www/wwwroot/www.mishejia.com/public/uploads/image/20230327/6e09410efcc200d2ab6f99ce705c86a7.HEIC-1769820766421a9c782d929.90318565"'

MaestroError commented 1 year ago

Hi @yuanxin32323, Thanks for opening an issue! Please try to run this command in your terminal:

/www/wwwroot/www.mishejia.com/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/www/wwwroot/www.mishejia.com/public/uploads/image/20230327/6e09410efcc200d2ab6f99ce705c86a7.HEIC" "/www/wwwroot/www.mishejia.com/public/uploads/image/20230327/6e09410efcc200d2ab6f99ce705c86a7.HEIC-1769820766421a9c782d929.90318565"

and show me the output please 👍

yuanxin32323 commented 1 year ago

@MaestroError I think some libraries may still be needed. Here is the output return. /www/wwwroot/www.mishejia.com/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /www/wwwroot/www.mishejia.com/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg)

MaestroError commented 1 year ago

@yuanxin32323 Hmm... Really strange issue! I am not sure if it can help you, but if you are on Linux try to run the following commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
peter-ptd commented 1 year ago

@MaestroError - I am getting this same error. We are on a Centos (Amazon Linux) Docker.

"Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: '/var/www/folder-name/public/uploads/images/imagename.heic' Full Command: '/var/www/folder-name/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/var/www/folder-name/public/uploads/images/imagename.heic" "/var/www/foldername/public/uploads/images/imagename.heic-520206829643806983e70c2.59088710"'

When calling HeicToJpg::isHeic($file) it returns true. Do you have any ideas what we can do to fix it. The images are saved locally in public uploads dir.

MaestroError commented 1 year ago

Hi, @peter-ptd! Please run this command manually:

/var/www/folder-name/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/var/www/folder-name/public/uploads/images/imagename.heic" "/var/www/foldername/public/uploads/images/imagename.heic-520206829643806983e70c2.59088710"

End let me know the output 👍

peter-ptd commented 1 year ago

Thanks for your response @MaestroError - this was my response:

/var/www/folder-name/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64: cannot execute binary file

HeicToJpg::convertOnMac($file, "arm64")->get(); I am on an M2 Macbook pro on Docker and used the code beforehand

peter-ptd commented 1 year ago

When running the above after running HeicToJpg::convert($srcFile)->get();

I get this message: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

MaestroError commented 1 year ago

@peter-ptd Sorry, I have no access to M2 Macbook, so I can't test it. As I understood you are on Mac and use docker with Linux, if the code is executed in docker container you should use HeicToJpg::convert($srcFile)->get() syntax, so try this solution from stackoverflow 👍

pbs-dg commented 1 year ago

From my observations, if image is not made on iPhone, than it will not convert. There must be a difference between file format implementations by Apple and others.