-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Managed to reproduce this issue. Was uploading an image with jquery.dm-uploader.min.js, and trying to do some image manipulation, but when I got this error: #3174
Comments
To be even more exact, I was getting this exception from trying to save a png file: imagepng($image, $imagePath, $quality). Or maybe it was happening from passing accidentally an image resource to getImageSize instead of a path... Not sure which one caused that exception from the post, as I was trying a few things, but definitely one of these two. Using PHP Version 7.4.4 |
Can you give a simple test script to replicate the problem? |
No, this was too long time ago for that, but I believe I gave enough information to reproduce it, and I'm not even sure if it was fixed or no in 4.0.4 |
I think this should be closed, because i had no problems uploading and manipulating the image. I had some problems with max_file_size for the validation rules, but they got fixed. |
You're completely missing the point. The issue of this case was doing something that should throw an exception, but the exception thrown was wrong, and had to actually get it by checking before FormatException.php... Therefore to reproduce it, you have to be unsuccessful to manipulate the image, as you need it to throw an error in the first place. But I will check if it still happens, and try to fix it, then do a pull request. |
If you can throw in the code from your |
Here is the code from my controller method:
Returns: exif_read_data(_DSC_0047_34657.jpg): Incorrect APP1 Exif Identifier Code Note this does not return an error on every image, only certain ones, and I haven't figured out what it is about the image...maybe it's a bad Exif identifier code =) If I can help by providing the _DSC_0047_34657.jpg image I used, just let me know how I can get it to you. Hope that helps |
Alright, found the actual problem, and it's on JSONFormatter.php ln.67 So in my latest case this json_encode was returning a JSON_ERROR_UNSUPPORTED_TYPE error, which caused it to enter this part: I can't post the full original error message, as it would be huge, but that's pretty much straight to the point |
@derektconsulting is your issue related to this one? This issue is on exception thrown on formatting, while yours is related to exception on exif. You should open a separate ticket for that. Short answer, exif only works on JPEG and TIFF files. It will likely fail on incompatible image types OR images with malformed headers. You should scrutinize that image. |
@pixobit since you are not giving any code that will truly help in reproducing the errors you encountered, I tried making one myself: // App\Controllers\Home
public function index()
{
// return view('welcome_message');
$data = fopen('php://output', 'w');
$result = json_encode($data, JSON_PRETTY_PRINT, 512);
// error here is JSON_ERROR_UNSUPPORTED_TYPE
// since a resource is not allowed for encoding
if (JSON_ERROR_NONE !== json_last_error())
{
throw FormatException::forInvalidJSON(json_last_error_msg());
}
var_dump($result);
} The exception is pretty much expected. |
Managed to reproduce this issue. Was uploading an image with jquery.dm-uploader.min.js, and trying to do some image manipulation, but when I got this error:
{title: "ErrorException", type: "ErrorException", code: 500, message: "getimagesize(): Read error!",…} code: 500 file: "C:\xampp\htdocs\project\app\Controllers\File.php" line: 85 message: "getimagesize(): Read error!" title: "ErrorException" trace: [{function: "errorHandler", class: "CodeIgniter\Debug\Exceptions", type: "->",…},…] type: "ErrorException"
Then I was basically getting the same response as the OP.
Note: I managed to get the real exception by printing in in the FormatException.php file
Originally posted by @pixobit in #1274 (comment)
The text was updated successfully, but these errors were encountered: