如何在虚拟机中将postgrsql数据库中的图像显示到本地

时间:2018-05-12 10:09:54

标签: php postgresql odoo

我正在尝试从PostgreSQL数据库中显示图像,而我正在检索黑屏。在字段 store_fname 我有该字段将为您提供我的Odoo内的图像文件的路径  文件存储的格式为'ab/abcdef0123456789'

<?php
$conn = pg_connect("user = admin password = admin host = 192.168.1.11 dbname = odoo");
$res = pg_query($conn, "SELECT id, store_fname FROM ir_attachment
WHERE res_model = 'res.partner' AND res_field = 'image' AND res_id = 3; ");
$raw = pg_fetch_result($res, 'store_fname');
header('Content-type: image/jpeg');
echo pg_unescape_bytea($raw);
?>

0 个答案:

没有答案