我在我的 Joomla 3.x 网站上使用 SobiPro,并且在我的条目中有一个自定义字段,它是一个图像,它存储在我的名为XXXX_sobipro_field_data
I have a 的表fid (field id)
中,对于 Image 字段,它等于 23。但是每个条目的数据看起来像这样:
jVFNT8JAEL37KzZ70kQp/US34WCgIEQ+AjUeyULXdgjtVrqgaPrf3d1WRA/E27438+a9maXEJZ8FcQiOqKDYp8SsMXuHF4XtGvcGj4HCnsK3EsOGjWnKsF8Qs0mway5gxRvrPNaMVXV0qWAhqC4gpmO2POuu5dj+ccIcPqqarPyw4SHXbE2N5ICKqqwgpTEz1jmrrGyC52wlgGdFj++ySJEtgjuT0SgYh9gv9RAJp09h0FU7OPVOiUg3qtuSad8gEkkbezZGCYM4Efqtqh7BD5pRkTwV3iX4WbUfCWk3KDp8w7d6GWV5mkBfFUhTSRU/C+7DyYygOLpRW6C92Wiiy10BWYwGwz4aToM+2nvW1TV63dENiANqo5Z7IXcpS22vT6DCOd/3KIyCLyHfcoNlYgsSu64Babz4/TFSK5JdutRa65xWt/1Ry1NL9A/fFf+jlD/AtxBDRvXFbe+c/FRafgE=
但是我需要显示图像,我应该如何处理这样的事情?
编辑
我这样做了:(它有效,但仅适用于 .png 图像)
<?php
$sid = $_GET["id"];
$db = mysql_connect("localhost", "admin", "root")
or die("Impossible de se connecter : " . mysql_error());
mysql_select_db('database_name',$db);
$sql = 'SELECT baseData, sid, fid FROM XXXX_sobipro_field_data WHERE sid = ' . $sid;
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
if ($data["fid"] == 22) {
$title = $data["baseData"];
}
if ($data["fid"] == 19) {
$desc = $data["baseData"];
}
if ($data["fid"] == 17) {
$activity = $data["baseData"];
}
if ($data["fid"] == 23) {
$enc_image = $data["baseData"];
$dec_image = unserialize(base64_decode($enc_image));
}
}
?>
<p>
<?php
echo "<span class=\"img\"><img src=\" ".$dec_image['original']." \" alt=\"\"> </img> </span>";
?>
<span class="title"><?php echo $title; ?></span>
<br />
<span class="activity"><?php echo $activity; ?></span>
<br />
<span class="desc"><?php echo $desc; ?></span>
</p>
<?php
mysql_close($db);
?>