How can I read out image_small (bytea) from hr_employee and pass to imagecreatefromtext (php) ?
// Performing SQL query
$dbconn = pg_connect(" host='".PGSQL_HOST."'
port='".PGSQL_PORT."'
dbname='".PGSQL_DBNAME."'
user='".PGSQL_USER."'
password='".PGSQL_PASSWORD."' ")or die('Could not connect: ' . pg_last_error());
$query='SELECT image_small
FROM hr_employee
WHERE id='.$im;
$result = pg_query($dbconn, $query) or die('Query failed: ' . pg_last_error());
$arr = pg_fetch_array($result);
$im=$arr['image_small']);
and now I have the string Then I tryed like this
$img = imagecreatefromstring($im);
if ($img !== false) {
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
}
say that the image cannot be displayed because it contains errors
any suggestions please ?