Как я могу загрузить изображение в тег img из поля bytea, используя PHP? - PullRequest
0 голосов
/ 01 марта 2019

как я могу загрузить картинку в тег img из поля bytea, используя php?Я использую базу данных postgresql

Что я пробовал:

<?php
// Connect to the database
$con_qupos = pg_connect('host=192.168.60.254 dbname=dbqupos user=postgres password=12345') or die(pg_last_error());

// Get the bytea data
$res = pg_query('select foto from "schSuperCristian".articulo_foto where codigo_referencia='."'8711600305960'");
$raw = pg_fetch_result($res, 'foto');

// Convert to binary and send to the browser
header('Content-type: image/jpeg');
echo pg_unescape_bytea($raw);
?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...