Go Back   Admin Zone Forums > The Software Zone > Forum Software > vBulletin

vBulletin Discuss vBulletin.

Reply
 
Thread Tools

  #1  
Old 01-08-2011, 04:52 PM
Octavius's Avatar
Octavius Octavius is offline
Tazmanian
 
Real Name: DRE
Join Date: Jan 2011
Admin Experience: Intermediate
Location: Pensacola, FL
Posts: 178
Octavius is a jewel in the rough
Default Picture and Album Gallery CMS and Forum Sidebar Widgets
By request, this is a quick tutorial on how to add photo widgets to your vbulletin CMS or Forum Sidebar.

Quote:
Originally Posted by BrandonSheley View Post
Welcome to the forums Dre
I like your site, especially the albums widget on the home page
I need to find out how to add that to my site
I'm looking forward to reading your post and hope you become an active member here at TAZ
Picture and Album Gallery is free. Get it here: http://www.vbulletin.org/forum/showthread.php?t=237931

Install it.

CMS Widget

Admin Control Panel / vBulletin CMS / Widgets / Create New Widget

Widget Type: PHP Direct Execution
Title: Pics from The Gallery
Description: Random Pictures From Public Albums

Save.

Then click on Configure


Code:
// Display random images thumbnails taken from any public albums.
// Author : Sulquendi
// Version: 1.2

// -- Widget Configuration -- 
$use_vB_thumbnail_size     = false;
$use_custom_css         = false;
$twidth                 = 190;
$limit                    = 8;
$albums_list            = "";


// -- Nothing to configure below this line --
if ($use_custom_css){
    $pthumb     = 'class="pthumb"';
    $pcaption    = 'class="pcaption"';
    $pmore        = 'class="pmore"';
    $pstyle        = '';
}else{
    $pthumb     = 'style="text-align:center;"';
    $pcaption    = 'style="text-align:center;font-style:italic;font-family: Times, serif;margin-bottom:10px;"';
    $pmore        = 'style="text-align:right;display:block;"';
    $pstyle        = 'style="border: 1px solid black;padding:4px;background: white;"';
}
if ($albums_list!="") $sup_cond = "AND alb.albumid IN ($albums_list)"; else $sup_cond ="";
ob_start();
require_once(DIR . '/includes/functions_album.php');
require_once(DIR . '/includes/functions_user.php');
$pic_get = vB::$db->query_read("
    SELECT     alb.albumid, att.attachmentid, att.userid, att.caption, att.dateline, att.state, fdt.filesize, IF(fdt.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fdt.thumbnail_dateline, fdt.thumbnail_width, fdt.thumbnail_height, u.username
    FROM ".TABLE_PREFIX."album AS alb
    LEFT JOIN ".TABLE_PREFIX."attachment AS att ON alb.albumid = att.contentid
    LEFT JOIN ".TABLE_PREFIX."filedata AS fdt ON att.filedataid = fdt.filedataid
    LEFT JOIN ".TABLE_PREFIX."user AS u ON att.userid = u.userid
    WHERE alb.state = 'public' AND att.contenttypeid = '8' $sup_cond
    ORDER BY rand(" . microtime()*1000000 . ") 
   LIMIT $limit");
  $output_bits = "";
  while($pic = vB::$db->fetch_array($pic_get))
  {
    $albuminfo = fetch_albuminfo($pic[albumid]);
    $picture = prepare_pictureinfo_thumb($pic, $albuminfo);
    if ($use_vB_thumbnail_size) $size = $picture[dimensions]; else $size = "width=$twidth";
    $output_bits .= "<div $pthumb><a href=\"album.php?{$vbulletin->session->vars['sessionurl']}albumid={$pic[albumid]}&attachmentid={$picture[attachmentid]}\"><img $pstyle src=\"attachment.php?{$vbulletin->session->vars['sessionurl']}attachmentid={$picture[attachmentid]}&thumb=1&d={$picture[thumbnail_dateline]}\" alt=\"{$picture[caption_preview]}\" $size /></a>";
    $output_bits .= "</div><div $pcaption>{$picture[caption_preview]} by {$pic[username]}</div>";
  }
$output_bits .= '<span '.$pmore.'><a href="album.php" alt="To the albums">More...</a></span>';
$output = $output_bits;
ob_end_clean();
Save.

CMS Widget

Admin Control Panel / Forums & Moderators / Forum Blocks Manager / Add Block /

Add Block Type: Custom HTML/PHP
Title: Pic From The Gallery
Description: Random Pictures From Public Albums
Content Type: PHP

Content:

Code:
// Display random images thumbnails taken from any public albums.
// Author : Sulquendi
// Version: 1.2

// -- Widget Configuration -- 
$use_vB_thumbnail_size     = false;
$use_custom_css         = false;
$twidth                 = 190;
$limit                    = 1;
$albums_list            = "";


// -- Nothing to configure below this line --
if ($use_custom_css){
    $pthumb     = 'class="pthumb"';
    $pcaption    = 'class="pcaption"';
    $pmore        = 'class="pmore"';
    $pstyle        = '';
}else{
    $pthumb     = 'style="text-align:center;"';
    $pcaption    = 'style="text-align:center;font-style:italic;font-family: Times, serif;margin-bottom:10px;"';
    $pmore        = 'style="text-align:right;display:block;"';
    $pstyle        = 'style="border: 1px solid black;padding:4px;background: white;"';
}
if ($albums_list!="") $sup_cond = "AND alb.albumid IN ($albums_list)"; else $sup_cond ="";
ob_start();
require_once(DIR . '/includes/functions_album.php');
require_once(DIR . '/includes/functions_user.php');
$pic_get = vB::$db->query_read("
    SELECT     alb.albumid, att.attachmentid, att.userid, att.caption, att.dateline, att.state, fdt.filesize, IF(fdt.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fdt.thumbnail_dateline, fdt.thumbnail_width, fdt.thumbnail_height, u.username
    FROM ".TABLE_PREFIX."album AS alb
    LEFT JOIN ".TABLE_PREFIX."attachment AS att ON alb.albumid = att.contentid
    LEFT JOIN ".TABLE_PREFIX."filedata AS fdt ON att.filedataid = fdt.filedataid
    LEFT JOIN ".TABLE_PREFIX."user AS u ON att.userid = u.userid
    WHERE alb.state = 'public' AND att.contenttypeid = '8' $sup_cond
    ORDER BY rand(" . microtime()*1000000 . ") 
   LIMIT $limit");
  $output_bits = "";
  while($pic = vB::$db->fetch_array($pic_get))
  {
    $albuminfo = fetch_albuminfo($pic[albumid]);
    $picture = prepare_pictureinfo_thumb($pic, $albuminfo);
    if ($use_vB_thumbnail_size) $size = $picture[dimensions]; else $size = "width=$twidth";
    $output_bits .= "<div $pthumb><a href=\"album.php?{$vbulletin->session->vars['sessionurl']}albumid={$pic[albumid]}&attachmentid={$picture[attachmentid]}\"><img $pstyle src=\"attachment.php?{$vbulletin->session->vars['sessionurl']}attachmentid={$picture[attachmentid]}&thumb=1&d={$picture[thumbnail_dateline]}\" alt=\"{$picture[caption_preview]}\" $size /></a>";
    $output_bits .= "</div><div $pcaption>{$picture[caption_preview]} by {$pic[username]}</div>";
  }
$output_bits .= '<span '.$pmore.'><a href="album.php" alt="To the albums">More...</a></span>';
$output = $output_bits;
ob_end_clean();
Save.

The code highlighted in red shows you where you can change the number of pictures displayed
__________________
https://8th.us
Reply With Quote
  #2  
Old 06-26-2011, 08:03 AM
osedaddy osedaddy is offline
TAZ Rookie
 
Join Date: Jun 2011
Posts: 2
osedaddy is on a distinguished road
Default
this works good with the cms. Can you tell me how long the time is before the new pics are generated? And can the time frame be changed?
Reply With Quote
  #3  
Old 06-28-2011, 07:31 AM
osedaddy osedaddy is offline
TAZ Rookie
 
Join Date: Jun 2011
Posts: 2
osedaddy is on a distinguished road
Default
Sorry I missed the obvious. The time variable is a simple field to fill in the options.
Reply With Quote
  #4  
Old 07-12-2011, 09:25 AM
bobscat bobscat is offline
TAZ Rookie
 
Real Name: Bobby
Join Date: Jul 2011
Posts: 1
bobscat is on a distinguished road
Default
Quote:
The code highlighted in red shows you where you can change the number of pictures displayed
good. 'cause i couldn't fiind the line the first time

google android development

Last edited by bobscat; 07-16-2011 at 11:04 AM..
Reply With Quote
  #5  
Old 07-18-2011, 03:53 AM
Octavius's Avatar
Octavius Octavius is offline
Tazmanian
 
Real Name: DRE
Join Date: Jan 2011
Admin Experience: Intermediate
Location: Pensacola, FL
Posts: 178
Octavius is a jewel in the rough
Default
I don't even remember posting this lol...
__________________
https://8th.us
Reply With Quote
  #6  
Old 08-05-2011, 03:24 AM
coffeelover coffeelover is offline
TAZ Rookie
 
Real Name: ???
Join Date: Aug 2011
Posts: 2
coffeelover is on a distinguished road
Default Thanks!
Quote:
Originally Posted by Octavius View Post
I don't even remember posting this lol...
Thanks for this little bit of code/add-on! It works great! I have been looking for a way to do this very thing on my forum. Quick question: Is there any way to bump everything from the top border (around the image) down about 2-5 pixels?

Thanks again!
Reply With Quote
  #7  
Old 08-12-2011, 12:51 AM
coffeelover coffeelover is offline
TAZ Rookie
 
Real Name: ???
Join Date: Aug 2011
Posts: 2
coffeelover is on a distinguished road
Default
Ok, I figured out how to create a little space above the thumbnail image. Here's the code I am using (slightly modified) just in case someone else bumps into this thread and wants to try it.

Thanks again to Octavius for making it available!

Code:
// Display random images thumbnails taken from any public albums.
// Author : Sulquendi
// Version: 1.2

// -- Widget Configuration -- 
$use_vB_thumbnail_size     = false;
$use_custom_css         = false;
$twidth                 = 160;
$limit                    = 2;
$albums_list            = "";


// -- Nothing to configure below this line --
if ($use_custom_css){
    $pthumb     = 'class="pthumb"';
    $pcaption    = 'class="pcaption"';
    $pmore        = 'class="pmore"';
    $pstyle        = '';
}else{
    $pthumb     = 'style="text-align:center;margin-top:10px;margin-bottom:4px;"';
    $pcaption    = 'style="text-align:left;font-style:italic;font-family: Times, serif;margin-bottom:10px;"';
    $pmore        = 'style="text-align:right;display:block;"';
    $pstyle        = 'style="border: 2px solid black;padding:4px;background: white;"';
}
if ($albums_list!="") $sup_cond = "AND alb.albumid IN ($albums_list)"; else $sup_cond ="";
ob_start();
require_once(DIR . '/includes/functions_album.php');
require_once(DIR . '/includes/functions_user.php');
$pic_get = vB::$db->query_read("
    SELECT     alb.albumid, att.attachmentid, att.userid, att.caption, att.dateline, att.state, fdt.filesize, IF(fdt.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fdt.thumbnail_dateline, fdt.thumbnail_width, fdt.thumbnail_height, u.username
    FROM ".TABLE_PREFIX."album AS alb
    LEFT JOIN ".TABLE_PREFIX."attachment AS att ON alb.albumid = att.contentid
    LEFT JOIN ".TABLE_PREFIX."filedata AS fdt ON att.filedataid = fdt.filedataid
    LEFT JOIN ".TABLE_PREFIX."user AS u ON att.userid = u.userid
    WHERE alb.state = 'public' AND att.contenttypeid = '8' $sup_cond
    ORDER BY rand(" . microtime()*1000000 . ") 
   LIMIT $limit");
  $output_bits = "";
  while($pic = vB::$db->fetch_array($pic_get))
  {
    $albuminfo = fetch_albuminfo($pic[albumid]);
    $picture = prepare_pictureinfo_thumb($pic, $albuminfo);
    if ($use_vB_thumbnail_size) $size = $picture[dimensions]; else $size = "width=$twidth";
    $output_bits .= "<div $pthumb>
<a href=\"album.php?{$vbulletin->session->vars['sessionurl']}albumid={$pic[albumid]}&attachmentid={$picture[attachmentid]}\">
<img $pstyle src=\"attachment.php?{$vbulletin->session->vars['sessionurl']}attachmentid={$picture[attachmentid]}&thumb=1&d={$picture[thumbnail_dateline]}\" alt=\"{$picture[caption_preview]}\" $size /></a>";
    $output_bits .= "</div><div $pcaption>{$picture[caption_preview]} by {$pic[username]}</div>";
  }
$output_bits .= '<span '.$pmore.'><a href="picall.php?" alt="View Member Images">More Images...</a></span>';
$output = $output_bits;
ob_end_clean();
Reply With Quote
  #8  
Old 12-18-2011, 02:43 PM
metindemirci metindemirci is offline
TAZ Rookie
 
Join Date: Dec 2011
Posts: 1
metindemirci is on a distinguished road
Default Picture and Album Gallery CMS and Forum Sidebar Widgets
hello
Vertical yours
Horizontal me Required

Last edited by metindemirci; 12-19-2011 at 01:16 AM..
Reply With Quote
  #9  
Old 12-18-2011, 03:52 PM
LloydM's Avatar
LloydM LloydM is offline
Tazmanian
 
Real Name: Lloyd M.
Join Date: Dec 2011
Admin Experience: Guru
Posts: 400
LloydM is a jewel in the rough
Default
Good Work!
Reply With Quote
  #10  
Old 01-31-2012, 06:27 PM
dune3000 dune3000 is offline
TAZ Rookie
 
Join Date: Jan 2012
Posts: 1
dune3000 is on a distinguished road
Default
Great work guys ..
is there any chance I can post only 1 or 2 pictures (fix pictures)
How I change time display in above

thank you,

Last edited by dune3000; 01-31-2012 at 06:41 PM..
Reply With Quote
  #11  
Old 01-29-2013, 07:18 AM
sstiller sstiller is offline
TAZ Rookie
 
Join Date: Jan 2013
Posts: 1
sstiller is on a distinguished road
Default
Thanks very much for these nice working Widget. I've integrated that in my forum.

Within my CMS i would like to show the picture horizontical. What have I to do, to show the thumbnails in a row instead of column.
Reply With Quote
  #12  
Old 02-06-2013, 07:19 PM
Octavius's Avatar
Octavius Octavius is offline
Tazmanian
 
Real Name: DRE
Join Date: Jan 2011
Admin Experience: Intermediate
Location: Pensacola, FL
Posts: 178
Octavius is a jewel in the rough
Default
I haven't the slightest idea. I use Xenforo now.
__________________
https://8th.us
Reply With Quote
Reply

  Admin Zone Forums > The Software Zone > Forum Software > vBulletin





Currently Active Users Viewing this Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Widgets Jezlad Community Organization 0 03-23-2009 04:09 PM
Simple picture gallery Libertate vBulletin 6 09-16-2007 11:28 PM
Transformers Picture Gallery goodgood Chit Chat 18 07-21-2007 12:46 PM
question about rules on picture content on my forum kaoswolf Chit Chat 1 09-29-2005 10:45 AM
Album/Gallery RidinHighSpeeds Increasing Traffic 3 07-15-2005 06:50 PM


 

All times are GMT -4. The time now is 08:11 AM.


Powered by: vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Page generated in 0.07446098 seconds with 13 queries
The Admin Zone copyright 2003-2014 All Rights Reserved. Content published on The Admin Zone requires permission for reprint.