endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.33k stars 721 forks source link

LogoImageData::createForLogo Verbose Errors #416

Closed smyhill closed 9 months ago

smyhill commented 9 months ago

Hi @endroid, thanks for this library it is very helpful.

I have run into a situation where the standard_5.php and gd.php methods used in createForLogo() (file_get_contents, imagecreatefromstring) have errors suppressed due to the @ prefix. It would be very helpful to have greater insight into the errors with my current implementation and was wondering if something like the proposed changes would be a possibility?

Clearly this is the first/quick solution that came to mind and it is not a necessity but I figured I would open this PR to start a discussion and did not want to come empty handed.

Having the option to not suppress the potential errors would help to gain further insight. We already get the generic error just below the try/catch if the return is not a string or image. But this skips the root cause of the issue from being shown if something goes wrong when the original methods are being called. I'm open to any ideas.

Thanks either way for your consideration and thanks again for this repo!

endroid commented 9 months ago

Hi @smyhill good idea to do something more with the warning message. In 4.8.5 I append the warning message to the exception message so you have more information. Thank you and good luck!