Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 161
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 143
Total: 143

Author Topic: Random header image code changes  (Read 7022 times)

0 Members and 1 Guest are viewing this topic.

Offline spanishsilver

  • Member
  • *
  • Posts: 5
    • View Profile
Random header image code changes
« on: September 18, 2007, 07:05:22 am »
I am using this code currently on my forum. Only thing is I want the images to come from attachments used in posts on forum. How would I go about changing this code so it does thank. Any help would be great Thanks
Code: [Select]
global $scripturl, $db_prefix, $modSettings, $boardurl, $ID_MEMBER;

/*
****************************************
****************************************
***    !! Admin Config Section !!    ***
****************************************
****************************************
*/

//   *****   LAYOUT OPTIONS   *****
// how many pictures do you want to show?
$gal_numpics = 10;

// use Normal Size Text, or Small Size Text? (0 = Normal Size, 1 = Small Size)
$gal_smalltext = 1;

// put pictures in how many columns?  (1 for left/right block, more for centerblock / article if you wish)
$gal_columns = 5;

// information display flags (0 = No, 1 = Yes)
// display picture title?
$gal_dispTitle = 1;
// display membername who posted pic?
$gal_dispMember = 1;
// display posted date?
$gal_dispDate = 1;
// display category the picture is in?
$gal_dispCategory = 0;
// display number of views?
$gal_dispViews = 0;
// display dimensions?
$gal_dispDimensions = 0;
// display filesize?
$gal_dispSize = 0;
// display picture description?
$gal_dispDescription = 0;


//   *****   SECURITY CONFIGURATION   *****
// do not allow the following category numbers to be displayed
// example: $gal_disallowCats = "4,2,7" - don't show categories 2, 4, or 7
$gal_disallowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 0;

/*
****************************************
****************************************
***  !! END Admin Config Section !!  ***
****************************************
****************************************
*/

//###############################################
//###############################################
//   You shouldn't change anything below here
//###############################################
//###############################################

if(empty($modSettings['gallery_url'])){
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}

$gal_textclass = empty($gal_smalltext) ? "normaltext" : "smalltext";

// allow member to view random pic based on security settings
if (empty($gal_viewPermission) || allowedTo('smfgallery_view')){
$gal_query = '
SELECT
thumbfilename,
ID_PICTURE,
ID_MEMBER,
date,
title,
description,
views,
filesize,
height,
width,
ID_CAT
FROM '.$db_prefix.'gallery_pic
WHERE
approved = 1
'.(empty($gal_disallowCats) ? "" : " AND ID_CAT NOT IN ($gal_disallowCats)").'
GROUP BY thumbfilename
ORDER BY rand() DESC
LIMIT '.$gal_numpics;

$gal_result = mysql_query($gal_query);
if (!$gal_result){
// error retrieving information from database
if (mysql_errno() == 1146){
echo '<p />Error, no database found!<p />';
} else {
echo '<p />MySQL error:'.mysql_error().'<p />';
}
} else {
echo "\n".'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%">'."\n";

$gal_colcnt = 1;
echo " <tr>\n";
while ($row = mysql_fetch_assoc($gal_result)){
if ($gal_colcnt > $gal_columns){
// close out the row and start a new row
echo " </tr>\n <tr>\n".' <td colspan="'.$gal_columns.'"><hr /></td>'."\n </tr>\n <tr>\n";
// reset count to column 1
$gal_colcnt = 1;
}
echo ' <td class="'.$gal_textclass.'" align="center">'."\n";
// display title if enabled, make edit link if viewing user is picture poster
if (!empty($gal_dispTitle)){
echo " ".($ID_MEMBER == $row['ID_MEMBER'] ? ('<a href="'.$scripturl.'?action=gallery;sa=edit;id='.$row['ID_PICTURE'].'">'.$row['title'].'</a>') : $row['title'])."<br />\n";
}
// display the picture thumbnail and link it to gallery full picture
echo ' <a href="'.$scripturl.'?action=gallery;sa=view;id='.$row['ID_PICTURE'].'"><img src="'.$modSettings['gallery_url'].$row['thumbfilename'].'" /></a><br />'."\n";
// display poster's name and posted date if enabled
if (!empty($gal_dispMember) || !empty($gal_dispMember)){
echo 'Posted';
if (!empty($gal_dispMember)){
// display the membername who posted pic?  need to get name based on ID_MEMBER
$gal_tmp = mysql_fetch_assoc(mysql_query("SELECT memberName FROM ".$db_prefix."members WHERE ID_MEMBER = ".$row['ID_MEMBER']));
echo ' by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$gal_tmp['memberName'].'</a>';
}
if (!empty($gal_dispDate)){
// display the date it was posted
echo ' on '.date("d M Y", $row['date']);
}
echo "<br />\n";
}
// display category if enabled
if (!empty($gal_dispCategory)){
// get category name based on category id
$gal_tmp = mysql_fetch_assoc(mysql_query("SELECT title FROM ".$db_prefix."gallery_cat WHERE ID_CAT = ".$row['ID_CAT']));
echo '<br />in<br /><a href="'.$scripturl.'?action=gallery;cat='.$row['ID_CAT'].'">'.$gal_tmp['title']."</a><br /><br />\n";
}
// display number of views if enabled
if (!empty($gal_dispViews)){
echo "Viewed ".$row['views']." times<br />\n";
}
// display dimensions if enabled
if (!empty($gal_dispDimensions)){
echo $row['width']."w X ".$row['height']."h<br />\n";
}
// display filesize if enabled
if (!empty($gal_dispSize)){
echo $row['filesize']." bytes<br />\n";
}
// display description if enabled
if (!empty($gal_dispDescription)){
echo "<br />".$row['description']."<br />\n";
}
echo " </td>\n";
$gal_colcnt++;
}
mysql_free_result($gal_result);
echo " </tr>\n</table>\n";
}
} else {
echo 'Sorry, you do not have permission to view pictures! Please register for an account or login.';
}

Offline spanishsilver

  • Member
  • *
  • Posts: 5
    • View Profile
Re: Random header image code changes
« Reply #1 on: September 19, 2007, 01:51:27 pm »
Anyone that can help me  :(

 

Related Topics

  Subject / Started by Replies Last post
112 Replies
150672 Views
Last post March 08, 2009, 11:52:44 am
by Raji
0 Replies
6739 Views
Last post April 12, 2010, 04:08:45 pm
by madman71
0 Replies
3202 Views
Last post September 28, 2010, 04:13:51 pm
by kizer
0 Replies
2522 Views
Last post August 13, 2011, 11:06:39 am
by Andy
5 Replies
5365 Views
Last post July 12, 2017, 03:45:34 pm
by donk

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal