Mythotical
11-20-2009, 12:04 AM
I came up with my own way to pull images but the thing about is that it won't pull the image on vB4.0, here is the template and file.
Template:
<img src="download.php?catimg={vb:var cid}" height="50">
Template with pulling image data through different file other than download.php:
<img src="cat.php?img={vb:var cid}" height="50">
Keep in mind the var $cid is pulled in the download.php file while the image pull is a separate file but right now I want to attempt to combine the files into one.
File:
if ($vbulletin->options['bfc_download_active']){
$img = $_REQUEST['img'];
$result = $db->query_read("SELECT cat_icon,cat_type FROM download_cats WHERE catid=" . $img);
while ($row = $db->fetch_array($result) ) {
$sid = $row['cid'];
$type = $row['cat_type'];
$encodeddata = $row['cat_icon'];
}
$data = @mysql_RESULT($result,0,'cat_icon');
$type = @mysql_RESULT($result,0,'cat_type');
header( "Content-type: $type");
echo $data;
}
Code that is pulling the data for the $cid variable:
$sql = $vbulletin->db->query_read("SELECT * FROM `" . TABLE_PREFIX . "download_cats` WHERE cat_active = '1'");
$total = $vbulletin->db->num_rows($sql);
$i=0;
$perrow = $total-2;
while ($row = $db->fetch_array($sql))
{
$cid = $row['catid'];
$cat = $row['catitle'];
$description = $row['cat_description'];
$caticon = $row['cat_icon'];
$i++;
if ($total !== 0)
{
if ($total > $perrow){
$catc = '</td>';
$perrow = $perrow+2;
} else {
$perrow = $perrow-2;
$catc = '</td></tr><tr>';
}
$catb = vB_Template::create('bfc_download_cat_bit');
$catb->register('cat_bit', $cat_bit);
$cat_bit .= $catb->render();
}
Any help much appreciated.
Thanks
Steve M
Template:
<img src="download.php?catimg={vb:var cid}" height="50">
Template with pulling image data through different file other than download.php:
<img src="cat.php?img={vb:var cid}" height="50">
Keep in mind the var $cid is pulled in the download.php file while the image pull is a separate file but right now I want to attempt to combine the files into one.
File:
if ($vbulletin->options['bfc_download_active']){
$img = $_REQUEST['img'];
$result = $db->query_read("SELECT cat_icon,cat_type FROM download_cats WHERE catid=" . $img);
while ($row = $db->fetch_array($result) ) {
$sid = $row['cid'];
$type = $row['cat_type'];
$encodeddata = $row['cat_icon'];
}
$data = @mysql_RESULT($result,0,'cat_icon');
$type = @mysql_RESULT($result,0,'cat_type');
header( "Content-type: $type");
echo $data;
}
Code that is pulling the data for the $cid variable:
$sql = $vbulletin->db->query_read("SELECT * FROM `" . TABLE_PREFIX . "download_cats` WHERE cat_active = '1'");
$total = $vbulletin->db->num_rows($sql);
$i=0;
$perrow = $total-2;
while ($row = $db->fetch_array($sql))
{
$cid = $row['catid'];
$cat = $row['catitle'];
$description = $row['cat_description'];
$caticon = $row['cat_icon'];
$i++;
if ($total !== 0)
{
if ($total > $perrow){
$catc = '</td>';
$perrow = $perrow+2;
} else {
$perrow = $perrow-2;
$catc = '</td></tr><tr>';
}
$catb = vB_Template::create('bfc_download_cat_bit');
$catb->register('cat_bit', $cat_bit);
$cat_bit .= $catb->render();
}
Any help much appreciated.
Thanks
Steve M