GithubHelp home page GithubHelp logo

maestroerror / php-heic-to-jpg Goto Github PK

View Code? Open in Web Editor NEW
122.0 122.0 20.0 40.43 MB

The easiest way to convert HEIC images to JPEG with PHP and Laravel framework

License: MIT License

Go 13.56% PHP 86.44%
golang heic-to-jpg heictojpg laravel php

php-heic-to-jpg's People

Contributors

danielgsoftware avatar fabiofdsantos avatar jdevinemt avatar maestroerror avatar marcoris avatar pbs-dg avatar shoresofnowhere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

php-heic-to-jpg's Issues

Couldn't convert HEIC to JPG

Hi I'm getting an error message 'Couldn't convert HEIC to JPG'. It's working fine on my local enviroment but when I upload this on my test link its now giving me that error message.

I've looked into the file and I found that on line 129
exec($command, $output)
This is not returning anything. Whereas on my local enviroment it is. Any suggestions on how to fix this?

Arm64 debian12 error reading "meta" box: got box type "mdat" instead

Getting error reading "meta" box: got box type "mdat" instead
After moving to Arm64 debian12 I am unable to get past this error. In old server this works fine.

/var/www/http/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "/volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.heic" "/volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.jpg"

2024/01/26 11:37:17 error reading "meta" box: got box type "mdat" instead
Error while converting /volumes/volume_1/app-storagetest/app/PXhhV4nOy5bt5DUIBmNsf0QCx8Zdztxuc2KhKvHl.heic: error reading "meta" box: got box type "mdat" instead
Created by MaestroError

the exec error

Call to undefined function Maestroerror\exec()

when i upload the project on linux shared host

Permission denied (absent execute-permission)

Hello, noticed interesting case.

WHAT I DID

i installed your package in 2 places:

  1. local development (docker) - Debian GNU/Linux 11 (bullseye) 5.4.0-137-generic
  2. dev-server Ubuntu 22.04.3 LTS 5.15.0-1031-aws

WHAT I GOT

i got different execute-permissions in these 2 cases.

  1. local development (docker)
    image

  2. dev-server
    image

in case 1 package works as expected.
in case 2 package works with error:

Couldn't convert HEIC to JPG: 'sh: 1: /home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64: Permission denied' | 
Bin used: 'php-heic-to-jpg-linux-arm64' HEIC: '/tmp/image-editor/image-editor-2iIvs9' 
Full Command: '/home/user/app/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "/tmp/image-editor/image-editor-2iIvs9" "/tmp/image-editor/image-editor-2iIvs9-19333623666504703814bc31.41181168" 2>&1' 
Output from heif-converter-image exe: 

when i add execute-permission for php-heic-to-jpg-linux-arm64 then package works as expected.

QUESTIONS

  1. why permissions are different on 2 environments?
  2. how should look correct execute-permissons for files?
  3. why in case 1 execute-permissions are absent for files php-heic-to-jpg-{os-architecture}, but package works as expected? and in case 2 - not?
  4. what is the suggestion to make it work in both cases (add execute-permissons for all needed files or something else)?

thanks!

make sure execution permission is set

we should add something like this:

$path   = MODULE_PATH  . 'lib/vendor/maestroerror/php-heic-to-jpg/bin/heicToJpg';
if(!is_executable($path)){
    chmod($path, 0555);
}

Windows version fails with Samsung images

It is failing with Samsung images on windows.

The work around is force it to use heif-converter-windows.exe

e.g.
Maestroerror\HeicToJpg::convert(DIR . '/tests/Unit/images/samsung-generated.heic", DIR . '/bin/heif-converter/bin/heif-converter-windows.exe' )->get();

install libheif on windows

The above requires libheif

run https://github.com/MaestroError/heif-converter-image/blob/maestro/install-libheif-windows.bat

then run
.\vcpkg.exe install

then manually set PATH & PKG_CONFIG_PATH see https://github.com/MaestroError/heif-converter-image/blob/maestro/install-libheif-windows.bat

-- install-libheif-windows.bat looks outdated - but it has the right steps

Temporary file not cleaned up on failure

What's the issue?

I have noticed that when the conversion process fails during the HeicToJpg::processImage() method, a temporary file is left behind in the same directory as the source file.

Why is this a issue?

This causes issues because we cannot assume that the source file resides in a directory that will automatically handle cleaning these temporary files up. In extreme cases it may cause a drive to become full on repeated errors.

How can I reproduce this issue?

Calling HeicToJpg::convert() on an HEIC image that the binary cannot process will produce the described issue.

The image that I discovered this issue with was the first image at the following site: https://filesamples.com/formats/heic

I encountered this in a container running Ubuntu 20.04.

The file that is left behind is created based on the following expression in the source code where $source is the full source path:

$newFileName = $source . "-" . uniqid(rand(), true);

What is a possible solution to this issue?

When processing the image and attempting to convert it via one of the binaries, delete the temporary file when an error is encountered if the temporary file exists.

PHP Error

I'm getting a PHP error while trying to convert. I'm running PHP 8.2 and GO 1.20.1:

$tmp_img_file = Maestroerror\HeicToJpg::convert('/var/www/example.com/dev/image1.heic')->get();

PHP Fatal error: Uncaught Error: Call to a member function convertImage() on null in /home/user/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php:209

I've verified that the image path is correct. The same path fed into Imagick works (but fails due to lack of HEIC support), so I don't think it's a path issue.

error reading "ftyp" box: got box type "\x00\x10JF" instead

I had been using php-heic-to-jpg successfully for several months, but now I am getting:

Couldn't convert HEIC to JPG: '2024/02/27 10:50:13 error reading "ftyp" box: got box type "\x00\x10JF" instead
Error while converting {filePath}.heic: error reading "ftyp" box: got box type "\x00\x10JF" instead
Created by MaestroError' | Bin used: 'heicToJpg.exe' HEIC: '{filePath}.heic'
Full Command: '{root}\vendor\maestroerror\php-heic-to-jpg\src/../bin/heicToJpg.exe "{filePath}.heic" "{filePath}.heic-161371566565de04b46309a8.17376750" 2>&1'
Output from heif-converter-image exe:  {"exception":"[object] (RuntimeException(code: 0): Couldn't convert HEIC to JPG: '2024/02/27 10:50:13 error reading \"ftyp\" box: got box type \"\\x00\\x10JF\" instead
Error while converting {filePath}.heic: error reading \"ftyp\" box: got box type \"\\x00\\x10JF\" instead
Created by MaestroError' | Bin used: 'heicToJpg.exe' HEIC: '{filePath}.heic' Full Command: {root}vendor\\maestroerror\\php-heic-to-jpg\\src/../bin/heicToJpg.exe \"{filePath}.heic\" \"{filePath}.heic-161371566565de04b46309a8.17376750\" 2>&1'
Output from heif-converter-image exe:  at {root}\\vendor\\maestroerror\\php-heic-to-jpg\\src\\HeicToJpg.php:205)

I tried updating and also downgrading to see if this was a version problem, but I couldn't get back to a working state. It definitely may be an interaction with another package my project brings in.

Happy to provide any other information!

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

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"'

How to convert files from an url?

Hi @MaestroError, first I'd like to say thanks for the amazing package! We currently use a external service to convert our heic to jpg's, but it would be more beneficial to be able to do this directly :).

I'm trying to convert heic files from a amazon s3 url, but unfortunately this doesn't seem to work. I get Couldn't convert HEIC to JPG: '' | Bin used: 'php-heic-to-jpg-darwin-amd64'.

When I try to do it with an a random heic file url I also get the same error.

When using a local path to a file, it all works.

My question is, how do I convert a heic file from an url?

Compatible with Ubuntu?

Hi @MaestroError, sorry for bothering you again so soon! I managed to successfully integrate the package in our code on my macbook M1. However, once deployed on our QA server (ubuntu), I get the Couldn't convert HEIC to JPG error. I've tried all the different methods and arch params, but I can't seem the get it to work.

Can you confirm that if you know the package should work with ubuntu as the OS?

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21'

I'm trying to run HeicToJpg::convert() on Centos7 server i receive error.
Couldn't convert HEIC to JPG: '(my path)/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by (my path)/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg)' | Bin used: 'heicToJpg' HEIC: '(path to image)/file_11.heic' Full Command: '(my path)/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "(path to image)/file_11.heic" "(path to image)/file_11.heic-1291524540650db72df3bf14.54402199" 2>&1' Output from heif-converter-image exe:

I've tried to launch bin heicToJpg from console and received the same error

./heicToJpg: /lib64/libstdc++.so.6: version 'GLIBCXX_3.4.21' not found (required by ./heicToJpg)

should I install something additional?

Debian x86_64: segmentation violation with heicToJpg, "cannot execute binary" with php-heic-to-jpg-linux-arm64

Hey,

on our Debian x86_64 with v1.0.4 I can't seem to find any working executable.

I'm running the full command in the terminal, replacing the binaries.

With php-heic-to-jpg-linux-arm64 I get: vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64 "storage/app/temp-files/20230914/6471f2e5-b306-49b3-b32c-8f9420d6dfed" "storage/app/temp-files/20230914/6471f2e5-b306-49b3-b32c-8f9420d6dfed-4749348066502c807d434b9.15606759" 2>&1

-bash: vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-linux-arm64: cannot execute binary file: Exec format error

With heicToJpg I get: vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "storage/app/temp-files/20230914/6471f2e5-b306-49b3-b32c-8f9420d6dfed" "storage/app/temp-files/20230914/6471f2e5-b306-49b3-b32c-8f9420d6dfed-4749348066502c807d434b9.15606759" 2>&1

2023/09/14 11:02:16 heif: no EXIF found
unexpected fault address 0x7fc434021010
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fc434021010 pc=0x4aeffc]

goroutine 1 [running]:
runtime.throw({0x530360?, 0x0?})
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc000191308 sp=0xc0001912d8 pc=0x4465fd
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:851 +0x28a fp=0xc000191368 sp=0xc000191308 pc=0x45ab6a
image/jpeg.yCbCrToYCbCr(0xc0000fc100, {0x5eb8e0?, 0x0?}, 0xc000191470, 0xc000191970, 0xc000191570)
/usr/local/go/src/image/jpeg/writer.go:461 +0x17c fp=0xc0001913e8 sp=0xc000191368 pc=0x4aeffc
image/jpeg.(*encoder).writeSOS(0xc0000000c0, {0x552a78?, 0xc0000fc100?})
/usr/local/go/src/image/jpeg/writer.go:547 +0x485 fp=0xc000191da0 sp=0xc0001913e8 pc=0x4af665
image/jpeg.Encode({0x552758?, 0xc000013188?}, {0x552a78, 0xc0000fc100}, 0x0)
/usr/local/go/src/image/jpeg/writer.go:634 +0x33f fp=0xc000191e18 sp=0xc000191da0 pc=0x4afadf
main.convertHeicToJpg({0x7ffd8b31965b?, 0xc00009e718?}, {0x7ffd8b3196a8, 0x6d})
/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:69 +0x1a6 fp=0xc000191ed8 sp=0xc000191e18 pc=0x4c0906
main.main()
/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:22 +0x50 fp=0xc000191f80 sp=0xc000191ed8 pc=0x4c0570
runtime.main()
/usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc000191fe0 sp=0xc000191f80 pc=0x448ee7
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000191fe8 sp=0xc000191fe0 pc=0x473801

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00009efb0 sp=0xc00009ef90 pc=0x449316
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.forcegchelper()
/usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc00009efe0 sp=0xc00009efb0 pc=0x449150
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00009efe8 sp=0xc00009efe0 pc=0x473801
created by runtime.init.6
/usr/local/go/src/runtime/proc.go:293 +0x25

goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00009f780 sp=0xc00009f760 pc=0x449316
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.bgsweep(0x0?)
/usr/local/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc00009f7c8 sp=0xc00009f780 pc=0x435f6e
runtime.gcenable.func1()
/usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc00009f7e0 sp=0xc00009f7c8 pc=0x42b446
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00009f7e8 sp=0xc00009f7e0 pc=0x473801
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:178 +0x6b

goroutine 4 [GC scavenge wait]:
runtime.gopark(0xc0000c8000?, 0x551008?, 0x1?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00009ff70 sp=0xc00009ff50 pc=0x449316
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:387
runtime.(*scavengerState).park(0x5fc920)
/usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc00009ffa0 sp=0xc00009ff70 pc=0x433eb3
runtime.bgscavenge(0x0?)
/usr/local/go/src/runtime/mgcscavenge.go:628 +0x45 fp=0xc00009ffc8 sp=0xc00009ffa0 pc=0x434485
runtime.gcenable.func2()
/usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc00009ffe0 sp=0xc00009ffc8 pc=0x42b3e6
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00009ffe8 sp=0xc00009ffe0 pc=0x473801
created by runtime.gcenable
/usr/local/go/src/runtime/mgc.go:179 +0xaa

goroutine 5 [finalizer wait]:
runtime.gopark(0x1a0?, 0x5fcd60?, 0x60?, 0x78?, 0xc00009e770?)
/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00009e628 sp=0xc00009e608 pc=0x449316
runtime.runfinq()
/usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc00009e7e0 sp=0xc00009e628 pc=0x42a487
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00009e7e8 sp=0xc00009e7e0 pc=0x473801
created by runtime.createfing
/usr/local/go/src/runtime/mfinal.go:163 +0x45

Here's the file information:

file heicToJpg

heicToJpg: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=149f9c872787030f9f4eea4de7d9f255736cd371, for GNU/Linux 3.2.0, with debug_info, not stripped

file php-heic-to-jpg-linux-arm64

php-heic-to-jpg-linux-arm64: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, Go BuildID=congiia-9eihUneMMSRM/0u1XgVabdwW4_DOqiRug/Bp_fdBq7zZjzqbukpHkj/ZDYppgUmdVCCQx1EnmYL, BuildID[sha1]=25bffd2c852fa88dc005587adef3249d43907197, not stripped

uname -r:

5.10.0-25-amd64

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

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?

Cannot convert HEIC to JPG on vps, CentOs 7

I tested on my windows local machine and everything works fine. But when I push to production, it breaks giving the error below. I'm using this package in a Laravel Application.

Error: Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: '/tmp/phpZHQoXP' Full Command: '/home/azychu/public_html/core/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/tmp/phpZHQoXP" "/tmp/phpZHQoXP-82110470764956f66edaa89.28636582"' Output from heif-converter-image exe: "}

Your requirements could not be resolved to an installable set of packages.

Hi there,

Many thanks for this package. I am trying to install 1.0 but composer doesn't seem to like it:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires maestroerror/php-heic-to-jpg 1.0 -> satisfiable by maestroerror/php-heic-to-jpg[v1.0].
    - maestroerror/php-heic-to-jpg v1.0 requires maestroerror/heif-converter dev-maestro -> found maestroerror/heif-converter[dev-maestro] but it does not match your minimum-stability.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

is there anything I am doing wrong here?

Thanks,
Matt

Laravel _ segmentation violation: Couldn't convert HEIC to JPG

I am getting this error on some images but some images work on my local. I am using the correct convert vs. HeicToJpg::convert methods.

Getting this error:

RuntimeException: Couldn't convert HEIC to JPG: '2023/09/28 09:42:58 heif: no EXIF found\nunexpected fault address 0x7f7969303010\nfatal error: fault\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x7f7969303010 pc=0x4aeffc]\n\ngoroutine 1 [running]:\nruntime.throw({0x530360?, 0x0?})\n /usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc000129308 sp=0xc0001292d8 pc=0x4465fd\nruntime.sigpanic()\n /usr/local/go/src/runtime/signal_unix.go:851 +0x28a fp=0xc000129368 sp=0xc000129308 pc=0x45ab6a\nimage/jpeg.yCbCrToYCbCr(0xc00008e080, {0x5eb8e0?, 0x0?}, 0xc000051470, 0xc000051970, 0xc000051570)\n /usr/local/go/src/image/jpeg/writer.go:461 +0x17c fp=0xc0001293e8 sp=0xc000129368 pc=0x4aeffc\nimage/jpeg.(*encoder).writeSOS(0xc000140000, {0x552a78?, 0xc00008e080?})\n /usr/local/go/src/image/jpeg/writer.go:547 +0x485 fp=0xc000129da0 sp=0xc0001293e8 pc=0x4af665\nimage/jpeg.Encode({0x552758?, 0xc0000120a8?}, {0x552a78, 0xc00008e080}, 0x0)\n /usr/local/go/src/image/jpeg/writer.go:634 +0x33f fp=0xc000129e18 sp=0xc000129da0 pc=0x4afadf\nmain.convertHeicToJpg({0x7fff8491c341?, 0xc000040718?}, {0x7fff8491c3a1, 0x81})\n /go/src/github.com/MaestroError/php-heic-to-jpg/main.go:69 +0x1a6 fp=0xc000129ed8 sp=0xc000129e18 pc=0x4c0906\nmain.main()\n /go/src/github.com/MaestroError/php-heic-to-jpg/main.go:22 +0x50 fp=0xc000129f80 sp=0xc000129ed8 pc=0x4c0570\nruntime.main()\n /usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc000129fe0 sp=0xc000129f80 pc=0x448ee7\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000129fe8 sp=0xc000129fe0 pc=0x473801\n\ngoroutine 2 [force gc (idle)]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000040fb0 sp=0xc000040f90 pc=0x449316\nruntime.goparkunlock(...)\n /usr/local/go/src/runtime/proc.go:387\nruntime.forcegchelper()\n /usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc000040fe0 sp=0xc000040fb0 pc=0x449150\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000040fe8 sp=0xc000040fe0 pc=0x473801\ncreated by runtime.init.6\n /usr/local/go/src/runtime/proc.go:293 +0x25\n\ngoroutine 3 [GC sweep wait]:\nruntime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000041780 sp=0xc000041760 pc=0x449316\nruntime.goparkunlock(...)\n /usr/local/go/src/runtime/proc.go:387\nruntime.bgsweep(0x0?)\n /usr/local/go/src/runtime/mgcsweep.go:319 +0xde fp=0xc0000417c8 sp=0xc000041780 pc=0x435fbe\nruntime.gcenable.func1()\n /usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000417e0 sp=0xc0000417c8 pc=0x42b446\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000417e8 sp=0xc0000417e0 pc=0x473801\ncreated by runtime.gcenable\n /usr/local/go/src/runtime/mgc.go:178 +0x6b\n\ngoroutine 4 [GC scavenge wait]:\nruntime.gopark(0xc00001e070?, 0x551008?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000041f70 sp=0xc000041f50 pc=0x449316\nruntime.goparkunlock(...)\n /usr/local/go/src/runtime/proc.go:387\nruntime.(*scavengerState).park(0x5fc920)\n /usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc000041fa0 sp=0xc000041f70 pc=0x433eb3\nruntime.bgscavenge(0x0?)\n /usr/local/go/src/runtime/mgcscavenge.go:633 +0x65 fp=0xc000041fc8 sp=0xc000041fa0 pc=0x4344a5\nruntime.gcenable.func2()\n /usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc000041fe0 sp=0xc000041fc8 pc=0x42b3e6\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000041fe8 sp=0xc000041fe0 pc=0x473801\ncreated by runtime.gcenable\n /usr/local/go/src/runtime/mgc.go:179 +0xaa\n\ngoroutine 5 [finalizer wait]:\nruntime.gopark(0x1a0?, 0x5fcd60?, 0x60?, 0x78?, 0xc000040770?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000040628 sp=0xc000040608 pc=0x449316\nruntime.runfinq()\n /usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000407e0 sp=0xc000040628 pc=0x42a487\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000407e8 sp=0xc0000407e0 pc=0x473801\ncreated by runtime.createfing\n /usr/local/go/src/runtime/mfinal.go:163 +0x45\n\ngoroutine 6 [GC worker (idle)]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000042750 sp=0xc000042730 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc0000427e0 sp=0xc000042750 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000427e8 sp=0xc0000427e0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25\n\ngoroutine 18 [GC worker (idle)]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00003c750 sp=0xc00003c730 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc00003c7e0 sp=0xc00003c750 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00003c7e8 sp=0xc00003c7e0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25\n\ngoroutine 19 [GC worker (idle)]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00003cf50 sp=0xc00003cf30 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc00003cfe0 sp=0xc00003cf50 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00003cfe8 sp=0xc00003cfe0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25\n\ngoroutine 34 [GC worker (idle)]:\nruntime.gopark(0xf6ee0b57ccf5?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000696750 sp=0xc000696730 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc0006967e0 sp=0xc000696750 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0006967e8 sp=0xc0006967e0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25\n\ngoroutine 35 [GC worker (idle)]:\nruntime.gopark(0xf6ee0b54ca2b?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000696f50 sp=0xc000696f30 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc000696fe0 sp=0xc000696f50 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000696fe8 sp=0xc000696fe0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25\n\ngoroutine 20 [GC worker (idle)]:\nruntime.gopark(0xf6ee0b54cade?, 0x0?, 0x0?, 0x0?, 0x0?)\n /usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00003d750 sp=0xc00003d730 pc=0x449316\nruntime.gcBgMarkWorker()\n /usr/local/go/src/runtime/mgc.go:1275 +0xf1 fp=0xc00003d7e0 sp=0xc00003d750 pc=0x42cfb1\nruntime.goexit()\n /usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00003d7e8 sp=0xc00003d7e0 pc=0x473801\ncreated by runtime.gcBgMarkStartWorkers\n /usr/local/go/src/runtime/mgc.go:1199 +0x25' | Bin used: 'heicToJpg' HEIC: '/var/www/html/storage/app/public/socialwall_posts/iUJKFJtZ09kNSOzZypO9nQT0I9kCLDEomGRLb7iX.heic' Full Command: '/var/www/html/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/var/www/html/storage/app/public/socialwall_posts/iUJKFJtZ09kNSOzZypO9nQT0I9kCLDEomGRLb7iX.heic" "/var/www/html/storage/app/public/socialwall_posts/iUJKFJtZ09kNSOzZypO9nQT0I9kCLDEomGRLb7iX.heic-149581381565154aa2b7a901.54543954" 2>&1' Output from heif-converter-image exe: in file /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php on line 204

Couldn't convert HEIC to JPG "segmentation violation"

I am getting this error on production server (Linux) but it works on my local Mac. I am using the correct convert vs. convertOnMac methods.

Getting this error:

Couldn't convert HEIC to JPG: 'unexpected fault address 0x7fb05ddac010\nfatal error: fault\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fb05ddac010 pc=0x4aeffc]\n\ngoroutine 1 [running]:\nruntime.throw({0x530360?, 0x0?})\n	/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc0000f7308 sp=0xc0000f72d8 pc=0x4465fd\nruntime.sigpanic()\n	/usr/local/go/src/runtime/signal_unix.go:851 +0x28a fp=0xc0000f7368 sp=0xc0000f7308 pc=0x45ab6a\nimage/jpeg.yCbCrToYCbCr(0xc0000c0100, {0x5eb8e0?, 0x0?}, 0xc000050470, 0xc000050970, 0xc000050570)\n	/usr/local/go/src/image/jpeg/writer.go:461 +0x17c fp=0xc0000f73e8 sp=0xc0000f7368 pc=0x4aeffc\nimage/jpeg.(*encoder).writeSOS(0xc0000c4180, {0x552a78?, 0xc0000c0100?})\n	/usr/local/go/src/image/jpeg/writer.go:547 +0x485 fp=0xc0000f7da0 sp=0xc0000f73e8 pc=0x4af665\nimage/jpeg.Encode({0x552758?, 0xc00009d1a0?}, {0x552a78, 0xc0000c0100}, 0x0)\n	/usr/local/go/src/image/jpeg/writer.go:634 +0x33f fp=0xc0000f7e18 sp=0xc0000f7da0 pc=0x4afadf\nmain.convertHeicToJpg({0x7ffcda40e2af?, 0xc000042718?}, {0x7ffcda40e32e, 0xa0})\n	/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:69 +0x1a6 fp=0xc0000f7ed8 sp=0xc0000f7e18 pc=0x4c0906\nmain.main()\n	/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:22 +0x50 fp=0xc0000f7f80 sp=0xc0000f7ed8 pc=0x4c0570\nruntime.main()\n	/usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc0000f7fe0 sp=0xc0000f7f80 pc=0x448ee7\nruntime.goexit()\n	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000f7fe8 sp=0xc0000f7fe0 pc=0x473801\n\ngoroutine 2 [force gc (idle)]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n	/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000042fb0 sp=0xc000042f90 pc=0x449316\nruntime.goparkunlock(...)\n	/usr/local/go/src/runtime/proc.go:387\nruntime.forcegchelper()\n	/usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc000042fe0 sp=0xc000042fb0 pc=0x449150\nruntime.goexit()\n	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000042fe8 sp=0xc000042fe0 pc=0x473801\ncreated by runtime.init.6\n	/usr/local/go/src/runtime/proc.go:293 +0x25\n\ngoroutine 3 [GC sweep wait]:\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\n	/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000043780 sp=0xc000043760 pc=0x449316\nruntime.goparkunlock(...)\n	/usr/local/go/src/runtime/proc.go:387\nruntime.bgsweep(0x0?)\n	/usr/local/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000437c8 sp=0xc000043780 pc=0x435f6e\nruntime.gcenable.func1()\n	/usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000437e0 sp=0xc0000437c8 pc=0x42b446\nruntime.goexit()\n	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000437e8 sp=0xc0000437e0 pc=0x473801\ncreated by runtime.gcenable\n	/usr/local/go/src/runtime/mgc.go:178 +0x6b\n\ngoroutine 4 [GC scavenge wait]:\nruntime.gopark(0xc000028070?, 0x551008?, 0x1?, 0x0?, 0x0?)\n	/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000043f70 sp=0xc000043f50 pc=0x449316\nruntime.goparkunlock(...)\n	/usr/local/go/src/runtime/proc.go:387\nruntime.(*scavengerState).park(0x5fc920)\n	/usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc000043fa0 sp=0xc000043f70 pc=0x433eb3\nruntime.bgscavenge(0x0?)\n	/usr/local/go/src/runtime/mgcscavenge.go:628 +0x45 fp=0xc000043fc8 sp=0xc000043fa0 pc=0x434485\nruntime.gcenable.func2()\n	/usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc000043fe0 sp=0xc000043fc8 pc=0x42b3e6\nruntime.goexit()\n	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000043fe8 sp=0xc000043fe0 pc=0x473801\ncreated by runtime.gcenable\n	/usr/local/go/src/runtime/mgc.go:179 +0xaa\n\ngoroutine 18 [finalizer wait]:\nruntime.gopark(0x1a0?, 0x5fcd60?, 0xa0?, 0x61?, 0xc000042770?)\n	/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000042628 sp=0xc000042608 pc=0x449316\nruntime.runfinq()\n	/usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000427e0 sp=0xc000042628 pc=0x42a487\nruntime.goexit()\n	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000427e8 sp=0xc0000427e0 pc=0x473801\ncreated by runtime.createfing\n	/usr/local/go/src/runtime/mfinal.go:163 +0x45' | Bin used: 'heicToJpg' HEIC: '{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic' Full Command: '{PATH}/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic" "{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic-138155045764e902f20811d2.70833782" 2>&1' Output from heif-converter-image exe:  {"exception":"[object] (RuntimeException(code: 0): Couldn't convert HEIC to JPG: 'unexpected fault address 0x7fb05ddac010\\nfatal error: fault\\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fb05ddac010 pc=0x4aeffc]\\n\\ngoroutine 1 [running]:\\nruntime.throw({0x530360?, 0x0?})\\n\t/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc0000f7308 sp=0xc0000f72d8 pc=0x4465fd\\nruntime.sigpanic()\\n\t/usr/local/go/src/runtime/signal_unix.go:851 +0x28a fp=0xc0000f7368 sp=0xc0000f7308 pc=0x45ab6a\\nimage/jpeg.yCbCrToYCbCr(0xc0000c0100, {0x5eb8e0?, 0x0?}, 0xc000050470, 0xc000050970, 0xc000050570)\\n\t/usr/local/go/src/image/jpeg/writer.go:461 +0x17c fp=0xc0000f73e8 sp=0xc0000f7368 pc=0x4aeffc\\nimage/jpeg.(*encoder).writeSOS(0xc0000c4180, {0x552a78?, 0xc0000c0100?})\\n\t/usr/local/go/src/image/jpeg/writer.go:547 +0x485 fp=0xc0000f7da0 sp=0xc0000f73e8 pc=0x4af665\\nimage/jpeg.Encode({0x552758?, 0xc00009d1a0?}, {0x552a78, 0xc0000c0100}, 0x0)\\n\t/usr/local/go/src/image/jpeg/writer.go:634 +0x33f fp=0xc0000f7e18 sp=0xc0000f7da0 pc=0x4afadf\\nmain.convertHeicToJpg({0x7ffcda40e2af?, 0xc000042718?}, {0x7ffcda40e32e, 0xa0})\\n\t/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:69 +0x1a6 fp=0xc0000f7ed8 sp=0xc0000f7e18 pc=0x4c0906\\nmain.main()\\n\t/go/src/github.com/MaestroError/php-heic-to-jpg/main.go:22 +0x50 fp=0xc0000f7f80 sp=0xc0000f7ed8 pc=0x4c0570\\nruntime.main()\\n\t/usr/local/go/src/runtime/proc.go:250 +0x207 fp=0xc0000f7fe0 sp=0xc0000f7f80 pc=0x448ee7\\nruntime.goexit()\\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000f7fe8 sp=0xc0000f7fe0 pc=0x473801\\n\\ngoroutine 2 [force gc (idle)]:\\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\\n\t/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000042fb0 sp=0xc000042f90 pc=0x449316\\nruntime.goparkunlock(...)\\n\t/usr/local/go/src/runtime/proc.go:387\\nruntime.forcegchelper()\\n\t/usr/local/go/src/runtime/proc.go:305 +0xb0 fp=0xc000042fe0 sp=0xc000042fb0 pc=0x449150\\nruntime.goexit()\\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000042fe8 sp=0xc000042fe0 pc=0x473801\\ncreated by runtime.init.6\\n\t/usr/local/go/src/runtime/proc.go:293 +0x25\\n\\ngoroutine 3 [GC sweep wait]:\\nruntime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)\\n\t/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000043780 sp=0xc000043760 pc=0x449316\\nruntime.goparkunlock(...)\\n\t/usr/local/go/src/runtime/proc.go:387\\nruntime.bgsweep(0x0?)\\n\t/usr/local/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000437c8 sp=0xc000043780 pc=0x435f6e\\nruntime.gcenable.func1()\\n\t/usr/local/go/src/runtime/mgc.go:178 +0x26 fp=0xc0000437e0 sp=0xc0000437c8 pc=0x42b446\\nruntime.goexit()\\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000437e8 sp=0xc0000437e0 pc=0x473801\\ncreated by runtime.gcenable\\n\t/usr/local/go/src/runtime/mgc.go:178 +0x6b\\n\\ngoroutine 4 [GC scavenge wait]:\\nruntime.gopark(0xc000028070?, 0x551008?, 0x1?, 0x0?, 0x0?)\\n\t/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000043f70 sp=0xc000043f50 pc=0x449316\\nruntime.goparkunlock(...)\\n\t/usr/local/go/src/runtime/proc.go:387\\nruntime.(*scavengerState).park(0x5fc920)\\n\t/usr/local/go/src/runtime/mgcscavenge.go:400 +0x53 fp=0xc000043fa0 sp=0xc000043f70 pc=0x433eb3\\nruntime.bgscavenge(0x0?)\\n\t/usr/local/go/src/runtime/mgcscavenge.go:628 +0x45 fp=0xc000043fc8 sp=0xc000043fa0 pc=0x434485\\nruntime.gcenable.func2()\\n\t/usr/local/go/src/runtime/mgc.go:179 +0x26 fp=0xc000043fe0 sp=0xc000043fc8 pc=0x42b3e6\\nruntime.goexit()\\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc000043fe8 sp=0xc000043fe0 pc=0x473801\\ncreated by runtime.gcenable\\n\t/usr/local/go/src/runtime/mgc.go:179 +0xaa\\n\\ngoroutine 18 [finalizer wait]:\\nruntime.gopark(0x1a0?, 0x5fcd60?, 0xa0?, 0x61?, 0xc000042770?)\\n\t/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc000042628 sp=0xc000042608 pc=0x449316\\nruntime.runfinq()\\n\t/usr/local/go/src/runtime/mfinal.go:193 +0x107 fp=0xc0000427e0 sp=0xc000042628 pc=0x42a487\\nruntime.goexit()\\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc0000427e8 sp=0xc0000427e0 pc=0x473801\\ncreated by runtime.createfing\\n\t/usr/local/go/src/runtime/mfinal.go:163 +0x45' | Bin used: 'heicToJpg' HEIC: '{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic' Full Command: '{PATH}/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg \"{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic\" \"{PATH}/storage/app/livewire-tmp/GJaKMOPh3waY8j6ZJJCNGTwixsaPJp-metaMkI4XzU3OTkuaGVpYw==-.heic-138155045764e902f20811d2.70833782\" 2>&1' Output from heif-converter-image exe:  at `{PATH}/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php:204

Server info:
Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1028-aws x86_64)

Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: 'explain.heic'

hi there.
i m facing this error on this lib.
can explain or guide me how can i fix this.

Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: 'file.com/sample1.heic' Full Command: '/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "file.com/sample1.heic" "file.com/sample1.heic-1909936596641d3c86bc59c0.67921754"'

and i am using laravel

Thank you.....

Error reading "meta" box: got box type "mdat" instead

Hello !

Today, I tried to use your library to convert HEIC to JPEG. However, when I attempted to use it, I encountered an error. I tried to debug the issue by executing the command directly :

/Applications/MAMP/htdocs/captus/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-amd64 "/pathtomyfile/8ivB0GLCbsWkfeHnfTbzZDC4pJP9YOAFeb9giBCH.heic" "/pathtomyfilet/8ivB0GLCbsWkfeHnfTbzZDC4pJP9YOAFeb9giBCH.heic-1943393784644fce698a1fe9.91263079"

I got this error :

2023/05/01 16:36:39 error reading "meta" box: got box type "mdat" instead

My code :

$fileIsHeic = HeicToJpg::isHeic(public_path($data['hunts'][$i]['imagesTemplates'][$k]['image']));
if ($fileIsHeic) {
$imageName = $this->generateRandomString(10);
HeicToJpg::convertOnMac(public_path($data['hunts'][$i]['imagesTemplates'][$k]['image']), "amd64")->saveAs(public_path("/upload/tmp/test.jpg"));
$data['hunts'][$i]['imagesTemplates'][$k]['image'] = "/upload/tmp/" . $imageName . ".jpg";
dump("ok");die();
}

Can you help me ?

Thanks !

How to display in html

Converting yo a jp file works fine, but below code snippet does not:

`$jpg = \Maestroerror\HeicToJpg::convert($path)->get();

	$base64=base64_encode($jpg);
	echo "<img src='data:image/jpeg;base64, $base64' alt='An elephant' />";`

It leads to a complete white page.

what to do?

convert not working on arm64 structure

I searched a solution for manipulating wrong loaded .heic files as jpeg, because I need the exif data from the files.

Your solution was a hope for getting this done.

Unfortunately I'm working on MacOS with ARM structure, which means, even my docker container executing the server runs with aarm64. Executing the convert errors to the following:

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
PHP Fatal error:  Uncaught RuntimeException: Couldn't convert HEIC to JPG:  in /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php:77
Stack trace:
#0 /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php(33): Maestroerror\HeicToJpg->processImage('/var/www/html/p...')
#1 /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php(123): Maestroerror\HeicToJpg->convertImage('/var/www/html/p...')
#2 /var/www/html/public/test.php(7): Maestroerror\HeicToJpg::convert('/var/www/html/p...')
#3 {main}
  thrown in /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php on line 77

Fatal error: Uncaught RuntimeException: Couldn't convert HEIC to JPG:  in /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php:77
Stack trace:
#0 /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php(33): Maestroerror\HeicToJpg->processImage('/var/www/html/p...')
#1 /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php(123): Maestroerror\HeicToJpg->convertImage('/var/www/html/p...')
#2 /var/www/html/public/test.php(7): Maestroerror\HeicToJpg::convert('/var/www/html/p...')
#3 {main}
  thrown in /var/www/html/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php on line 77

Is there any possibility getting this cool library work on aarm architecture, too?

Used architechutre:

Linux web 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux

RCE on the exec PHP-Class function

Question

Is there an other possibility to run the command in other functions then exec?

PoC

Setting filename to ";whoami;# is showing the whoami command on the system:
image

ls is also possible in that example so as cd ... You can combine multiple commands as shown here:
cs ..;ls

Couldn't covert HEIC to JPG

RuntimeException : Couldn't convert HEIC to JPG: '' | Bin used: 'php-heic-to-jpg-darwin-arm64' HEIC: '/private/var/folders/xq/bbvlc8r52gsfpxxg6f7f3_p40000gn/T/bjDSfN' Full Command: '/path/to/project/vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64 "/private/var/folders/xq/bbvlc8r52gsfpxxg6f7f3_p40000gn/T/bjDSfN" "/private/var/folders/xq/bbvlc8r52gsfpxxg6f7f3_p40000gn/T/bjDSfN-6597740986440740f359aa1.01134626"'

Output of command:

[1]    41341 killed

Update: still no fix, but I have some more info.

Fails:

HeicToJpg::convertOnMac($tempPath, 'arm64')->saveAs($tempPath);

Passes:

HeicToJpg::convertOnMac($tempPath, 'amd64')->saveAs($tempPath);

I'm using an M1 MacBook Air. convert also fails, presumably because the OS is detected as arm64, and the bin for that is failing.

Compiled binaries are not compatible with Cent OS 7

Compiled binaries are not compatible with Cent OS 7 becauase its using GLIB glibc-2.17-326.el7_9.x86_64 and these binaries are compiled with GLIBCXX_3.4.21.
can you please suggest how can i handle that as my server i am unable to upgrade OS due to it will not support cpanel. i have vps

"message": "Couldn't convert HEIC to JPG: '/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg)' | Bin used: 'heicToJpg' HEIC: public/storage/PLTSWZNCzNuZmJ.heic' Full Command: '/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg "/public/storage/PLTSWZNCzNuZmJ.heic" "/public/storage/PLTSWZNCzNuZmJ.heic-17096726566600e542cc83d9.54541371" 2>&1' Output from heif-converter-image exe: ",
"exception": "RuntimeException",

Works on some images and errors with others

Hi @MaestroError - I'm having a problem with some HEIC images (about half) giving an error while converting. Then, other HEIC images convert without issue. It's the image itself that determines if it fails or not. Any image that fails to convert will keep failing when I try again.

Sample files:
works.heic
fails.heic

Error:
Fatal error: Uncaught RuntimeException: Couldn't convert HEIC to JPG: '' | Bin used: 'heicToJpg' HEIC: '/var/www/example.com/public_html/content/images/temp/fails.heic' Full Command: '/var/www/composer/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg /var/www/example.com/public_html/content/images/temp/fails.heic /var/www/example.com/public_html/content/images/temp/fails.heic-181417596641365983cec09.38828464' in /var/www/composer/vendor/maestroerror/php-heic-to-jpg/src/HeicToJpg.php:139
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.