View Full Version : Forum Gallery
colicab-d
05-18-2003, 12:42 AM
Hi all im working ona new forum gallery hack, which will take all the images posted to a forum and show them all nicely..
Anyway im having a few probs with it, ive got the initial query ok, but i cant get it to skip entrys that have no filedata in the attachment (the blank attachments vb seems to create)
Im using basic code at mo no $DBsite query stuff just to get it working i,ll concentrate on all of that later.. anyway i need a helper or helpers and i will have this done anyday..
the main prob is the one stated
anyway heres the code i have for it at the moment which isnt working too well at all..
while($r = mysql_fetch_array($galquery1)){
$galentid=$r['attachmentid'];
$galtime=$r['dateline'];
$galentry=$r['filedata'];
$galentryname=$r['filename'];
$galuserid=$r['userid'];
$galentryvisible=$r['visible'];
if(!$galentry){
$imgshowno = "No Image";
echo ("$imgshowno");
}
else
{
$imgshow = "<img src = $bburl/attachment.php?postid=$galentid ><br>";
$imgshow.= "<a href = $bburl/attachment.php?postid=$galentid>Full Image</a><br><br>";
echo ("$imgshow");
}
Note I have it putting in a "No image" just for test purposes at current
filburt1
05-18-2003, 01:00 AM
Once again, you need to get in the habit of perfectly indenting; all problems will be solved except the ones that don't get solved :)
colicab-d
05-18-2003, 01:02 AM
i will later but this isnt helping the code problem and yes again i do have the } for the while loop at the end.
i mean i have it in there (not above) but its there, i just dont wanna show some of the internal comments i have in the script at mo, but other wise aside from my sloppy indentation all
{`s and }`s are accounted for :D
all problems will be solved except the ones that don't get solved
Spot the obvious :)
Dean C
05-18-2003, 10:06 AM
Ummm isn't this a double-post :)?
- miSt
colicab-d
05-18-2003, 01:11 PM
can someone help me? im this close to getting a working gallery
filburt1
05-18-2003, 02:03 PM
No offense but we can't do everything for you. I very strongly suggest that you indent properly from the get-go...it helps immensely, especially for us ;)
Dark_Wizard
05-18-2003, 02:24 PM
Yes...proper indenting helps us to help you quicker...
colicab-d
05-18-2003, 02:35 PM
thnx guys... was only looking for some friendly help
Dark_Wizard
05-18-2003, 06:46 PM
Today at 11:35 AM colicab-d said this in Post #9 (https://vborg.vbsupport.ru/showthread.php?postid=396707#post396707)
thnx guys... was only looking for some friendly help
We are trying to help but all we are asking is you follow coding ethics...
colicab-d
05-18-2003, 07:36 PM
well turns out all i needed to be told was to add the command empty..
anyway it seems its actually not a prob to do with my code but more the actual ids of attachments.. for some reason its querying everything except them ok...
so i,ll need to have a good look into how the attachments are working regarding postids etc as its not how i had initially thought
that or the sql is wrong.. but that seems to be ok as its taking the data on the basis of per forum id
anyways heres all the code :D .. in case that helps lol
note its sloppy as ive been editing it like mad to get this id`s prob fixed
<?php
error_reporting(7);
require("./global.php");
if ($attachcount = 1 ){}
//TEST SCRIPT CONFIGS ///
$galcat = "12"; //forum id you wish to view the attachments of
$slimit = "10"; // last x attachments to show
/////////////////////////
/* $galcats should be the gallerys ids set in the admin panel
these can be exploded with a , so that they may be set easily,
optional is if they are stored in anew mysql table and maybe
queried at the start then the code can work on the basis of
( for galleryid?=$galcat then do the query below for that id )
also to be added is a query / function to retrieve the thread id
of each attachemnt (will look at the attachemnt file for this) */
$galquery1 = mysql_query("SELECT *
FROM attachment
LEFT JOIN post USING(attachmentid)
LEFT JOIN thread USING(threadid)
WHERE thread.forumid = $galcat
ORDER by attachmentid desc
LIMIT $slimit");
while( $r = mysql_fetch_array($galquery1) )
{
$galentid=$r['attachmentid'];
$galtime=$r['dateline'];
$galentry=$r['filedata'];
$galentryname=$r['filename'];
$galuserid=$r['userid'];
$galentryvisible=$r['visible'];
if( empty($galentryname) )
{
$imgshowno = "No Image";
echo ("$imgshowno");
}
elseif ($galentryname)
{
$imgshow = "<img src = $bburl/attachment.php?postid=$galentid ><br>";
$imgshow.= "<a href = $bburl/attachment.php?postid=$galentid>Full Image</a><br><br>";
echo ("$imgshow");
}
echo "$galentid<br>" ;
echo "$galentryname<br>" ;
}
/*the code for skipping the table entry $filedata when its empty (!$filedata)
must also be enetered aswell as the code for exploding the file name via a .
so as to abtian the attachment and create the correct thumbnail as well */
?>
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.