我正在尝试从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);
?>