You code seems to be working, but the problem can be multiple.
First of all, I recommend that you do not use the @
operator, cause you'll not see any error in you code. It's very important for you and us to know the trigger errors to see potential issue.
Then, if you still don't see an error, try activating it by adding the following from the start of your file:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
An other way to enable errors is to enable there options directly on your php.ini file.
Now, as your code looks functional, this is some possible mistake that may be causing your troubles :
- Unable to establish connection in HTTP due to a problem of root certificates on your server
- Maybe the directory 'assets' or 'rkgia_image' does not exists, or both
- Unable to write to directory due to permission problem
- [or other]