I bumped into an error with the thumbnail generator for some Joomla library.
Each of the images generated would not having any image info inside but having error message instead.

So, upon checking , can’t trace from the log file.
I did tried to open up the file using the text edit , and found out it had the following content
instead of image data.

When can be read out as :

<br />
<b>Warning</b> : trim() expects parameter 1 to be string , resource given in <b> /path/to/filename.php </b> on line

Upon checking the said filename ,
found out it is using trim() function for php.

and these is just a warning message , not an error.

one of the quick solution is suppress the warning message by adding the following line before that line.

error_reporting(0);
$path = trim($path);

After that, the thumbnail was generated perfectly again.. :)

or maybe can also use something similar as below ( ** UNTESTED ** ):