Welcome Guest, Not a member yet? Register   Sign In
Exceptions exceptions...
#2

(This post was last modified: 04-19-2020, 03:16 PM by Leo.)

Hi Gary,
Any progress? I've just encountered same issue in my project.


Details: A user downloads an image from some website that is labeled with a .jpeg extension. It is actually a .heic image (if microsoft paint is to be trusted) and I get an exception during attempted upload. Instead, when this happens, I want to display an info message: "This image type is unsupported/image has additional copyright measures added. You may try and open it in ms paint and re-save it as .jpeg (works 100%)". Instead I get throw ImageException::forInvalidImageCreate('Ima'); in GDHandler.php

So far solved like this:
PHP Code:
try {
     
//my library function for image uploading, editing
     $new_images $simpleImg->upload();
} catch (\
CodeIgniter\Images\Exceptions\ImageException $e) {
     session()->setFlashdata('message',
'This image type is unsupported/image has additional copyright measures added. You may try and open it in ms paint and re-save it as .jpeg (works 100%)');


This code catches ALL exceptions within \CodeIgniter\Images\Exceptions\ImageException
How do I display my own message exactly for forInvalidImageCreate?
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Reply


Messages In This Thread
Exceptions exceptions... - by Gary - 04-17-2020, 07:07 AM
RE: Exceptions exceptions... - by Leo - 04-19-2020, 02:08 PM
RE: Exceptions exceptions... - by Gary - 04-19-2020, 04:20 PM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 12:12 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 02:56 AM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 06:05 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 06:52 AM
RE: Exceptions exceptions... - by Leo - 04-20-2020, 10:31 AM
RE: Exceptions exceptions... - by Gary - 04-20-2020, 01:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB