Closed XbNz closed 10 months ago
Hey, @XbNz! Thanks for contacting 👍 Yes, it is recommended to use converOnMac method for MacOS users to specify the architecture, because sometimes it doesn't find the correct one
Hey, @XbNz! Thanks for contacting 👍 Yes, it is recommended to use converOnMac method for MacOS users to specify the architecture, because sometimes it doesn't find the correct one
Hey,
The issue actually isn't platform detection. It correctly detects my M1 chip and uses the arm64 bin. But the arm64 bin just doesn't work. Even if I do ->convertOnMac('arm64')
it will fail.
Hmm.. but it worked on M1, try and run this command manually in your console:
/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"
@XbNz And how HeicToJpg::convertOnMac($tempPath, 'amd64')->saveAs($tempPath);
passes? It shouldn't work on M1, did you try it on another device?
try and run this command manually in your console
./vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-arm64
[1] 95938 killed
@XbNz And how HeicToJpg::convertOnMac($tempPath, 'amd64')->saveAs($tempPath); passes? It shouldn't work on M1, did you try it on another device?
No idea. It works though:
./vendor/maestroerror/php-heic-to-jpg/src/../bin/php-heic-to-jpg-darwin-amd64
Not enough arguments, needs: [command] [file1.heic] [file2.jpg]
Created by MaestroError
Of course, here I'm not passing any arguments, but even when including arguments, the arm process crashed and gets killed.
I have not tried it on any other machines.
@XbNz So if amd64 works for you, Why don't you just use it? (convertOnMac($tempPath, 'amd64')
) it seems you have M1 but with amd64 architecture. Can you check your arch?
@XbNz So if amd64 works for you, Why don't you just use it? (
convertOnMac($tempPath, 'amd64')
) it seems you have M1 but with amd64 architecture. Can you check your arch?
uname -m
output: arm64
The reason why I don't use it is because production runs on x86 and I'd have to keep switching it manually in the codebase. I can attach it to an env var but I'm just wondering if anyone else is having this issue with your bins.
@XbNz Wow! It is a really strange issue 😄 Not sure for now, I know who uses the amd64, but he isn't on M1, so not sure what is the problem here.
And I don't know anybody who uses it this way: convertOnMac($tempPath, 'arm64')
@XbNz Wow! It is a really strange issue 😄 Not sure for now, I know who uses the amd64, but he isn't on M1, so not sure what is the problem here.
I think the mapping isn't entirely correct. I ran into the same issue some time ago. I believe M1 is always arm64 arch, can't be amd64.
Hey, @XbNz ! Any updates? Did you fix the issue?
Hi @MaestroError,
I get this error
Couldn't convert HEIC to JPG: 'Error while converting C:\\OpenServer\\domains\\sphinx-search-api\\public/temp/IMG_4672.heic: error reading \"ftyp\" box: read C:\\OpenServer\\domains\\sphinx-search-api\\public/temp/IMG_4672.heic: Incorrect function.\\nCreated by MaestroError' | Bin used: 'heicToJpg.exe' HEIC: 'C:\\OpenServer\\domains\\sphinx-search-api\\public/temp/IMG_4672.heic' Full Command: 'C:\\OpenServer\\domains\\sphinx-search-api\\vendor\\maestroerror\\php-heic-to-jpg\\src/../bin/heicToJpg.exe \"C:\\OpenServer\\domains\\sphinx-search-api\\public/temp/IMG_4672.heic\" \"C:\\OpenServer\\domains\\sphinx-search-api\\public/temp/IMG_4672.heic-75242546364c003ac720153.71727791\"' Output from heif-converter-image exe:
Using windows
On server Ubuntu same
Couldn't convert HEIC to JPG: 'Error while converting /var/www/search-service-sphinx/public/temp/IMG_4672.heic: error reading \"ftyp\" box: read /var/www/search-service-sphinx/public/temp/IMG_4672.heic: is a directory\\nCreated by MaestroError' | Bin used: 'heicToJpg' HEIC: '/var/www/search-service-sphinx/public/temp/IMG_4672.heic' Full Command: '/var/www/search-service-sphinx/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic\" \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic-203845678564c00613e24bc0.96288394\"' Output from heif-converter-image exe:
Hey, @XbNz ! Any updates? Did you fix the issue?
Missed the notification 😄
No, I was not able to find a fix. The solution for me was to use the Linux binaries in production, and when I'm running my test suite on Mac, I need to manually set it to use the convertOnMac
AMD64 binary which works for me, as I mentioned previously.
@XbNz could you please explan how to use Linux binaries, thanks in advance
@XbNz could you please explan how to use Linux binaries, thanks in advance
You do not have to set the binaries manually. The package should detect your operation system and use the corresponding binaries. In my case, this functionality is failing on MacOS, but works well in my production environment.
Based on your error message, it seems like '/var/www/search-service-sphinx/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic\" \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic-203845678564c00613e24bc0.96288394\"'
is causing a failure. Try to run this command directly in your terminal.
@XbNz
I run command
ubuntu@ip-xxx-xxxx-xx:/var/www/search-service-sphinx/public/temp$ /var/www/search-service-sphinx/vendor/maestroerror/php-heic-to-jpg/src/../bin/heicToJpg \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic\" \"/var/www/search-service-sphinx/public/temp/IMG_4672.heic-203845678564c00613e24bc0.96288394\"
and get this
Error while converting "/var/www/search-service-sphinx/public/temp/IMG_4672.heic": open "/var/www/search-service-sphinx/public/temp/IMG_4672.heic": no such file or directory Created by MaestroError
But in folder I see this file
ubuntu@ip-xxx-xxxx-xx:/var/www/search-service-sphinx/public/temp$ dir IMG_4671.heic IMG_4672\ -\ Copy.heic IMG_4672.heic
Hi @SkyNetRu! Your original error error reading \"ftyp\" box:
is because this package doesn't support some types of HEIC images (also was problems with 'mdat' type), try to install heic-converter-image package according to this documentation
@MaestroError thank you, but I used this JS library and it cover all my needs https://github.com/alexcorvi/heic2any
Thanks for sharing @SkyNetRu 👍
Hey @MaestroError I am attempting to use this project on an M1 Macbook Pro (the first generation one) and running into this too. I tried to debug by running these commands manually from the bin
folder:
# This does NOT work, results in "killed" output, no other errors
./php-heic-to-jpg-darwin-arm64 "/Users/austen/Desktop/test.HEIC" "/Users/austen/Desktop/test.jpg" 2>&1
# This does work
./php-heic-to-jpg-darwin-amd64 "/Users/austen/Desktop/test.HEIC" "/Users/austen/Desktop/test.jpg" 2>&1
Is there something else we can do to debug this? Happy to help out if I can, and thank you for the package!
Hello, @austenc! Thank you very much for reaching out! I was sure that M1 was on arm64, but it seems, in our case, it works only with the amd64 build 😄 Not sure how can we debug it, I will just add note in Docs about it 👍 I'm happy you came to offer help, thanks for that ❤️
Output of command:
Update: still no fix, but I have some more info.
Fails:
Passes:
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.