Blob bytea datatype column

Blob bytea datatype column

UMR5558UMR5558 Posts: 41Questions: 13Answers: 0

Hello everybody
How can i use a bytea datatype column from my data base in a datatable or in the editor for generating a pict in the html.
What the php look like and how can i convert the data in json. The conversion must be in the php or in a specific postgresql query?
Thanks for your help.
Lionel

Answers

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    I presume that bytea is an image? If so, I would suggest rendering an img tag into your DataTable with an address such as src="/image.php?id=" (obviously adding in the image id).

    Then read the byte array from the db and use the PHP image functions such as createimage. It means you have a request and query per image.

    Your only other option would be to base64 encode the images into the HTML file - but that could end up being massive.

    Allan

Sign In or Register to comment.