class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
I am quite surprised, because PHP executes file -bi image.jpg in the class code, through shell_exec, and gets regular file. But if you run it at the command line, you have image/jpeg. There is something weird on MacOS, but I don't have a machine to investigate.
In the meantime, you can comment the block of code underneath: "// checks MIME type with shell if unix access is authorized". This will deactivate this method of MIME detection, and the class should work again.Reply
- MIME type detected as regular file by UNIX file() command
...
file_src_mime : regular file
Terminal :
$ file -bi image.jpg
image/jpeg
I am quite surprised, because PHP executes file -bi image.jpg in the class code, through shell_exec, and gets regular file. But if you run it at the command line, you have image/jpeg. There is something weird on MacOS, but I don't have a machine to investigate.
In the meantime, you can comment the block of code underneath: "// checks MIME type with shell if unix access is authorized". This will deactivate this method of MIME detection, and the class should work again.