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

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

Open James-THEA opened 7 months ago

James-THEA commented 7 months ago

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!

MaestroError commented 7 months ago

Hi @James-THEA, thanks for reaching out 👍

This type of issue is more related to file type. Some HEIC images have different box type which isn't readable by this package, especially if it isn't original HEIF, but converted one.

Also, your "Full Command" from the error looks different, it shouldn't contain strings like "{root}" and "{filePath}", did you replace them before posting here or it was like that in the error message?

You should be able to copy your "Full Command" from the error message and run it from the console. Please, do it and let me know the output 👍

hbjlee17 commented 4 months ago

@MaestroError running into the same error here is the command run directly from console.

./heicToJpg 6c3df2bd-f919-4d7f-a07d-1681775b1ead.HEIC test.jpg
2024/05/23 00:45:11 error reading "ftyp" box: got box type "\x00\x10JF" instead
Error while converting 6c3df2bd-f919-4d7f-a07d-1681775b1ead.HEIC: error reading "ftyp" box: got box type "\x00\x10JF" instead
Created by MaestroError
MaestroError commented 4 months ago

@hbjlee17 Thanks for reaching out! ❤️ As I said this error is related to box type of HEIC images, I am sure you have this issue only on some images, right?

Here you can try different solutions, the first is working in conjunction with this package and enhancing its capabilities, the second and third are alternative ways, which are already offered by the community: