View Full Version : vBgallery
smashingyoungman
12-12-2006, 11:49 PM
Hasn't anyone written a module that will allow images from vBgallery to be displayed on vbDrupal's frontpage? This is something I'd love to see.
smashingyoungman
12-20-2006, 10:06 AM
Anyone have any ideas? Though I realize that this would probably be better suited to the "Blocks" forum.
The Gallery module would let you do something like this with the Drupal side...but it's had some troubles with vbDrupal from what I've read in the forums.
smashingyoungman
12-21-2006, 12:24 PM
Thanks for the response, bill. :)
Actually, I believe I could get vBgallery's included image block to work on a vBdrupal page if I could just get the variables to work. I tried adding the variables to the .theme file as instructed here, http://www.vbdrupal.org/forum/showthread.php?t=33, but it doesn't seem to work. The variables are simply printed as text, no matter the input format used.
sifuhall
12-22-2006, 01:06 AM
I wrote a snippet for the front_page module that displays the most recent images from vbgallery.
You can see it here:
http://www.dragonslist.com
Fenriz
07-18-2007, 02:05 PM
sifuhall, could you share the code please?
sifuhall
07-19-2007, 10:46 AM
I sure can.
This works in the front_page module and pulls the lastest images from my vb gallery. You will have to adjust this code if your database is different. (Also change the heading from latest kung fu photos to whatever you want, etc.).
<?php
$threads = pager_query(db_rewrite_sql("select *
from " . TABLE_PREFIX . "adv_gallery_images
where valid = 1
order by dateline desc"), 4);
?>
<br />
<table align="center" border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<td colspan="4" class="drupalcenterbox"><strong>Latest Kung Fu Photos</strong></td>
</tr>
<tr>
<?php
while ($thread = db_fetch_object($threads)) {
$filepath = "/gallery/files/";
$count = 0;
while ($count <= strlen($thread->userid)) {
$filepath .= substr($thread->userid,$count,1) . "/";
$count ++;
}
// remove last slash
$filepath = substr($filepath,0,strlen($filepath)-1);
// get filename
$thread->thumbname = $filepath . $thread->thumbname;
print "
<td class=\"alt1\">
<table border=\"0\">
<tr>
<td align=\"center\" class=\"smallfont\">
<a href=\"/gallery/showimage.php?i=$thread->imageid\"><img src=\"$thread->thumbname\" border=\"1\" class=\"shadow\" alt=\"kung fu photo\" /></a>
<br />
$thread->title
<br /> by $thread->username
</td>
</tr>
</table>
</td>
";
}
unset($thread, $threadbits, $filepath, $count);
?>
</tr>
</table>
bszopi
08-30-2008, 09:00 AM
I just found this and it works great. I added a little more functionality to it though, to include image view via lightbox (when clicking on thumb), link to gallery (when clicking on title) and link to user's profile (when clicking on user's name).
<?php
$threads = pager_query(db_rewrite_sql("select *
from " . TABLE_PREFIX . "ppgal_images
where valid = 1
order by dateline desc"), 4);
?>
<table align="center" border="0" cellpadding="1" cellspacing="1" width="100%">
<tr>
<?php
while ($thread = db_fetch_object($threads)) {
$filepath = "/forum/gallery/files/";
$count = 0;
while ($count <= strlen($thread->userid)) {
$filepath .= substr($thread->userid,$count,1) . "/";
$count ++;
}
// remove last slash
$filepath = substr($filepath,0,strlen($filepath)-1);
// get filename
$thread->thumbname = $filepath . $thread->thumbname;
print "
<td class=\"alt1\">
<table border=\"0\">
<tr>
<td align=\"center\" class=\"smallfont\">
<a href=\"$filepath/$thread->filename\" rel=\"lightbox\"><img src=\"$thread->thumbname\" border=\"1\" class=\"shadow\" alt=\"60V6 Photo Gallery\" /></a>
<br />
<a href=\"/forum/gallery/showimage.php?i=$thread->imageid\">$thread->title</a>
<br />Owmer : <a href=\"/forum/member.php?u=$thread->userid\">$thread->username</a>
</td>
</tr>
</table>
</td>
";
}
unset($thread, $threadbits, $filepath, $count);
?>
</tr>
</table>