SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x89PNG\x0D\x0A...' for column 'new_value' at row 6
IGaMbLeRI opened this issue · 2 comments
Trying to save an image (.png) to MySQL as BLOB.
This is due to the migration mentioned in the Installation Guide having audit_trail
.old_value
and audit_trail
.new_value
set as TEXT. Changing them to BLOB/MEDIUMBLOB/LARGEBLOB fixes the error.
Not sure what your take on this is, however, the Diff column tries to display the image binary and creates a lot of unnecessary scrolling.
Having said that, maybe it is possible to set the "display value" via anonymous function in order to output HTML? E.g. generate a <img/>
from what is stored in the DB? Maybe this mechanism exists.. I didn't find it in the docs.
Defaulting column values to something else as text seems like a pretty niche thing as we haven't received a single question about this so far. Solutions to this issue would IMO be more along the lines what I did for the emails: if there's a custom callback function defined it could be called instead of the default output. Dunno if that would be useful and I'd have to think about the whole, as I did the email thing as a patch and definitely don't want to route all render functions like that.