I'm currently experiencing a weird problem while I converted a web application to ODBC using PostgreSQL (coming from MySQL with PHP mysqli-connector).
I noticed that images that are stored as a bytea
in PostgreSQL database and thrown into PHP's base64 function are not shown correctly. At some point it's cut off after a couple of lines. This cut off is with all bytea
image data that is stored in our database, we have that for logos and signatures.
If you inspect the img tag with the browser's inspector you'll see (at least in Chrome) that there is a lot data of that image missing.
What I do is a SELECT * FROM table
and then in a for-loop encode the image as base64:
$clients[$i]['logo'] = base64_encode($clients[$i]['image']);
$clients[$i]['image'] = this is the bytea in the database and
$clients[$i]['logo'] = this is the base64 String that I display in a Smarty template like this: data:image/png;base64,{$client.logo}
I hope you can help.