(Note: new features in red)
What it is:
This block displays random, newest, oldest, most/least viewed or commented picture(s) from your SMF Gallery mod inside a block of your choice. Actually, it displays the thumbnail and links to the full picture.
Type of block:
This is a phpblock. It can be any block/article position (left/right/center/front/article). If you use it in a left/right block, you should set the columns to 1. If you use a center/frontpage/article block, then set the columns to however many you want.
This block snippet can be used in multiple simultaneous blocks using the same or different configuration settings in each without issue.
Features:
- configurable number of pictures to display
- sort order to display newest/oldest or most/least pics
- configurable number of columns to display the pictures in
- enable title display (if viewer is picture poster, it becomes a link to edit the picture)
- displayed thumbnail links to full picture from the gallery
- enable display of picture poster (links to their profile)
- enable display of date posted
- enable display of category picture is in (links to that gallery category)
- enable display of number of views
- enable display of picture dimensions (width X height)
- enable display of picture's filesize
- enable display of picture's description
- can disallow pictures from various categories
- can allow pictures only from various categories (disallowed cats override)
- only displays approved pictures
- configurable to require allowedTo('smfgallery_view') permission or not for viewing thumbnail
- display pics posted by a member who's profile you are viewing, in the profile screen (see profile note)
- display pics posted by members in your buddy list
- display # of comments with link to picture/comments
Profile Note: You must enable panels (blocks) for the profile screen via TinyPortal -> Settings -> Panels -> Hide panels when in these sections: -> Profile screen: No
Buddy List Note: This will work everywhere except under the following condition:
- you have the option to display profile pics turned on in an SMF Gallery Random Pic block that displays while in the profile screen, and you are currently viewing some member's profile.
In otherwords, the Profile pics display will override the buddy pics display in that case. If this same block however, displays on other pages (frontpage, forum, etc) then the buddy pics will display in the block when on those pages!
See the Admin configuration section in code for each configuration variable.
////////////////////////////////////////////////////
// SMF Gallery Random Picture - ver. 1.8 //
////////////////////////////////////////////////////
//
// Developed by Thurnok
// Thurnok -AT- tinyportal .DOT. net
// November 30, 2006
//
// Updated 9/26/2008
// 1.8
// - added display # of comments option
//
// Used in a TinyPortal phpblock or Article.
// This block displays random/most/least/newest/oldest picture(s) from
// the SMF Gallery mod along with other information
//
//////////////////////////////////////////////
global $scripturl, $db_prefix, $modSettings, $boardurl, $ID_MEMBER, $user_info, $context;
/*
****************************************
****************************************
*** !! Admin Config Section !! ***
****************************************
****************************************
*/
// ***** LAYOUT OPTIONS *****
// how many pictures do you want to show? 0 = all!
$gal_numpics = 1;
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;
// enable profile pics display?
// 0 = disable, 1 = enable --- if enabled, and you are viewing a member profile, show pics from that member only
// other options still apply (showtype, sort order, etc)
$gal_profile = 1;
// only show pics from buddies?
// 0 = disable, 1 = enable --- if enabled, will only show pics posted by members in your buddy list
$gal_buddies = 0;
// 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 = 1;
// 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 = 1;
// display number of views?
$gal_dispViews = 1;
// display dimensions?
$gal_dispDimensions = 1;
// display filesize?
$gal_dispSize = 1;
// display picture description?
$gal_dispDescription = 0;
// display # comments
$gal_dispNumComments = 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 = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
/*
****************************************
****************************************
*** !! 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";
// get this user's buddy list
$gal_buddylist = implode(",", $user_info['buddies']);
// prep for our switch routine
if (empty($gal_showtype))
$gal_showtype = 0;
// sort text
if (empty($gal_sort)){
$gal_sort_text = 'DESC';
} else {
$gal_sort_text = '';
}
// are we viewing a member profile and $gal_profile is enabled?
if (!empty($gal_profile) && strtolower($context['current_action']) == "profile"){
$gal_member = empty($_GET['u']) ? $ID_MEMBER : $_GET['u'];
}
// 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,
commenttotal,
ID_CAT
FROM '.$db_prefix.'gallery_pic
WHERE approved = 1
'.(empty($gal_member) ? (empty($gal_buddies) ? "" : (empty($gal_buddylist) ? "AND ID_MEMBER = NULL " : "AND ID_MEMBER in ($gal_buddylist)")) : "AND ID_MEMBER = $gal_member" ).'
'.(empty($gal_disallowCats) ? "" : " AND ID_CAT NOT IN ($gal_disallowCats)").'
'.(empty($gal_allowCats) ? "" : " AND ID_CAT IN ($gal_allowCats)").'
GROUP BY thumbfilename ';
switch ($gal_showtype){
// most/least recent
case 1:
$gal_query .= '
ORDER BY date '.$gal_sort_text;
break;
// most/least viewed
case 2:
$gal_query .= '
ORDER BY views '.$gal_sort_text;
break;
// most/least commented
case 3:
$gal_query .= '
ORDER BY commenttotal '.$gal_sort_text;
break;
default:
$gal_query .= '
ORDER BY rand() '.$gal_sort_text;
break;
}
$gal_query .= (empty($_GET['gal_viewall']) && !empty($gal_numpics)) ? ' 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_dispDate)){
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";
}
// display # of comments if enabled
if (!empty($gal_dispNumComments)){
echo '<br /><i><a href="'.$scripturl.'?action=gallery;sa=view;id='.$row['ID_PICTURE'].'">'.$row['commenttotal']."</a> comment(s)</i><br />\n";
}
echo " </td>\n";
$gal_colcnt++;
}
mysql_free_result($gal_result);
echo " </tr>\n</table>\n";
if (!empty($gal_member) && empty($_GET['gal_viewall']))
echo '<br /><a href="'.$boardurl.'/index.php?action=profile;u='.$gal_member.';gal_viewall=1">View all pics from this member</a>';
if (!empty($gal_buddies) && empty($_GET['gal_viewall'])){
// build the link
$gal_querystring = $context['TPortal']['querystring'];
$gal_querystring .= empty($gal_querystring) ? 'gal_viewall=1' : ';gal_viewall=1';
echo '<br /><a href="'.$boardurl.'/index.php?'.$gal_querystring.'">View all pics of buddies</a>';
}
}
} else {
echo 'Sorry, you do not have permission to view pictures!';
}
way out man!! now this is one heck of a well thought out and made block!! you rock! thanks :D
Wow great job done there! Thx a lot. :)
Thanks guys...
Quick update - added capability to allow/disallow viewing based on allowedTo('smfgallery_view') permission.
So, you can either have it set so a user is required to have the View SMF Gallery permission in their membergroup, or you can allow members view the random pic (the thumbnail) even if they are not allowed to view the gallery. They will not be able to view the full picture if that is the case, just the thumbnail in the Random Picture block.
Update in first post.
this may be a stupid question.. but do i put this code in a php block or in the .php file itself?
i figured it out :)
AH!! Thank you Thurnok, works great on Dennis site :)
http://208.116.3.217/index.php
Nifty piece of code but one question: How do I get the size of the text the same as in other LeftBlocks?
Wat do I need to add/change and where as I'm a complete php noobie.
TIA
Lum-chan
Great code Thurnok!
Could the code be altered to be shown on a front page block to fit the block instead of a thumbnail and fade in and out for each picture.
Once again this is a great block and a testament of the team here at Tinyportal in support of the community.
New version in first post with a small update (no pun intended).
The new version now uses the "smalltext" class (of TP's) by default. You can use either the "normaltext" or "smalltext" class by changing the new variable in the user config section: $gal_smalltext
$gal_smalltext = 1; // use TP's "smalltext" class
$gal_smalltext = 0; // use TP's "normaltext" class
@Lum-chan - get new code, copy/paste - done.
@pinegr05 - There is a slide show block that does something like that already. It should be in the block code snippets here somewhere.
Thanks Thurnok. I have been playing with the codes in the admin section and I have put the code in an article. Makes for a neat team page.
Thanks again!
Thanks Thurnok! Works like a charm now :up:
does it work with coppermine? modifing the url /gallery/ with the url of the directory in which is installed cpm?
No. This directly accesses the database entries for the SMF Gallery Mod (written by vbgamer45). It also uses SMF Gallery Mod's permission setup as well. It will not work for Coppermine without completely rewriting it (for the most part).
gasp...ok.. sob
Thanks Thurnok! I just added it to my site, for a demo look here: http://www.oblivion.gr/forums/index.php
Looks good there. Nice guild site. :)
I love this mod. It really works well in my site. I have a another mod almost like this one but i had to upload pics manually to a folder. (is getting turned off).
Not anymore!!!! This mod rocks! Thanx Thurnok for this sweet mod!! You Rock!
Looks like it was made special just for your site. :)
Nice bike btw.
Quote from: Thurnok on December 29, 2006, 12:07:26 AM
Looks like it was made special just for your site. :)
Nice bike btw.
Thnx!
Quote from: Thurnok on December 28, 2006, 09:36:33 PM
Looks good there. Nice guild site. :)
You're welcome :)
how can i resize image with this script to put all the image in the same size at the block?
The SMF Gallery Random Picture block doesn't do any sizing of the picture at all. What you see is the thumbnail created by the SMF Gallery Mod itself.
So whatever the thumbnail size is, that's what is displayed. The thumbnails are created by the SMF Gallery Mod and based on the original size of the picture. I'm not sure what the maximum height/width of the thumbnail is, but it is beyond the control of the block itself.
This is a really nice piece of coding, very clean. I implemented it at www.ps3hax.com
thanks.
Hello there!
I get a message "Error, no database found!" where the block would be.
The only bit I altered (because it was incorrect was path in my case was /gallery2
Any help appreciated thanks :)
EDIT : Bugger, thought this was for Gallery2, not SMF Gallery, ah welll :-X :(
Wonderful Mod. Thanks for putting it together for us.
O0
Quote from: houston on January 26, 2007, 12:55:17 AM
Wonderful Mod. Thanks for putting it together for us.
O0
Yup exactly, thx alot! :up:
Got it on my site as well. G6 told me to get this block code, so I did :)
Great! Thanks!
beautiful snippet !!
thanks man ;)
Glad you like it! :)
(This is the first block I have tried to create, so apologies in advance if this is user error.)
I receive the following error:
QuoteParse error: syntax error, unexpected $end in /Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 177
Thank you for any assistance.
If you copied the code in the first post and made a PHP block for it on your forum, you should not get an error.
Make sure you have pasted the entire code in a PHP block.
Thank you G6.
I happened to miss the final } which threw the whole thing off.
DOH!
We have all done that one time or another. :D
Glad you got it to work
One problem I noticed was when you go to minimize the whole left block it seems to remove all the blocks but this one... Is there something in the Admin portion of the script that needs to be changed? to see what I see. go here... www.dawnofannihilation.com/doa-forum
Login: test3
Password: 1234
if i'm right this code is for not displaying specific categories of images gallery
// 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 = "";
what change should be done in the original code in order to display random images only from categories i want?
in fact i want to display only one category but i think the solution of displaying more than one preferred categories will fit everybody's needs and will make this snippet just the best one !! :laugh:
I'll add an option to only display certain categories this weekend.
@Craven
I went to your site, and upshrinked left and right blocks. Used Mozilla, FireFox, and IE - didn't see what you are reporting....
What browser/version are you using?
Wow, very nice. Works very well. GREAT JOB!
Can you also do a latest images block for smf gallery pro ?
Just installed it and it works great!!!
Thank you!!!
Quote from: Mannie on March 11, 2007, 06:30:26 PM
Can you also do a latest images block for smf gallery pro ?
I've already been thinking about modifying this block to allow the admin to select options for:
- latest x number of pix
- most viewed x number of pix
- most commented x number of pix
- top pic poster's x number of pix
also thinking about adding a slideshow option for the future...
:up:
That would be great, specially for my site
Mannie!!!!
:P
Mr Gray!!
;D
Quickie update by request at my TPBlocks site:
Update 1.3
- added ability to display pics only from categories you specify (example: $allowCats = "1,3,9")
- disallowed categories override allowed categories (example: $disallowCats = "3" -- prevents category 3 pics from being displayed even tho above example has it in $allowCats)
see code for info
Updated code in first post
This update will be good for you if you have many categories and only want random pics from 1 or a few categories. Easier than putting alot of categories in the $disallowCats variable. Also prevents you from having to add more categories to the $disallowCats every time you create more SMF Gallery categories that you do not want random pics displayed from.
Update 1.4
- added ability to choose between recent pics and random
- added sort option so can display (x) most recent or oldest pics
see code for info
Updated code in first post
Update 1.5
- added ability to choose between random or most/least recent/viewed/commented pictures
- added sort option to display (x) most/least of above options
see code for info
Updated code in first post
Here's a screenshot of some sample uses...
thanks will update my block ;)
Awesome, thank you!
hmm? I have 4 photos in the gallery. I just installed the latest update on my site right block= gallery upload
www.therockpile.org
config says this
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;
yet it doesnt change pics.
the one in the right block down a little =random pic from 12/27 works right
The top one is set for random pic right. I know you added stuff. Do I need to change something else?
thanks. Do I have to put the ones I want random in a special category?
The pictures do not randomly change ... seems I am stuck on the same 5 pictures.
I went back to an older version of your code (http://www.tinyportal.net/index.php?topic=15073.msg124980#msg124980) and it works fine.
I have 6 Category's in my Galley and I would like the code to show from all the Categorys I have not one.
Any ideas?
Update 1.5.1
- FIX: Left out the random option when I added the other options - woops ::)
@Shadow Queen
You can use as many or as little categories you like for the block. If you leave the $gal_disallowCats and the $gal_allowCats variables empty (the default) then it will take random/recent/viewed/commented pics from all categories.
If you only want a single, or a couple categories to display, use the $gal_allowCats variable to identify those. If you want all except a single or couple of categories to display then use the $gal_disallowCats to identify the ones not to display.
Update 1.5.2
- FIX: Couldn't display date unless member name was also displayed, can now display just the date option if desired
... can't believe no one mentioned this yet, probably in the code since first release.. :2funny:
I have to found that in the code?
No you don't have to find it in the code, he updated the first post. :)
Thank's you for telling me Ich :)
Edited --
THe code work great so far :)
Works good thank you sir.
I'm sure I'm overlooking something simple (and I don't mind if someone points that out to me) ;) but... how do I get this block to show up on the gallery page if the gallery url is: http://mysite.com/index.php?action=gallery. I made the block centered and with 5 most recent pictures with 5 columns. Now i'm trying to select the TP block settings so it just shows up on that url above but I can't find that selection among the drop-downs.. and http://mysite.com/gallery shows me the folder, not the gallery. hmm.... can anyone help? :D
You can use this block to display a random pic (or pics) anywhere - your home page, or any other part of your SMF/TP site.
When you wish to display any TP block somewhere specifically, you use the:
Show for this action
(custom action name)
field of the block settings. If the specific area (action) you wish to show the block on does not exist in the "pulldown" menu to the right, simply leave the pulldown set at -none- and manually enter the action code in the editbox that is just to the right of the pulldown.
In otherwords, enter gallery in the editbox that is to the far right on the Show for this action (custom action name) field in the block settings for your block.
ahh... the custom action fixed it. thanks for your help!
Hmmmm..gallery installed and working good..but where i must to put this code??
In the first post he gives you all the info you need.
QuoteType of block:
This is a phpblock.
So, in a block is where you put the code.
Hi Thurnock,
This is the best way I can think of explaining this.
What I want to achive is that when you are viewing a members profile, you can see the first 20 (configurable) of that members gallery pics (thumbs) in a block on the profile, with a link to view all if more exist. If they have no gallery pics then the block would state this.
I can make the block appear with no problems by setting the action selection as =profile.
Is it possible to amend the code for this block and create a new block called 'SMF Gallery Pics in Profile' - that would be a cool block :)
Regards,
Wilsy.
Wow!!! Thanks for this mod, Thurnok.
I put up our site a few months ago with some basic Gallery block I found here, not knowing about this one.
Ever since then, I had been glaring at the pitiful thing every time I visited our site. I kept thinking, "Wouldn't it be cool if that block showed this and that..." Turns out I wasn't the only one! Your block is EXACTLY the kind of thing I was looking for. I wish I had found it first!
And thank you for making it so simple to follow, too. Even though I can generally dig deep into code and find ways to alter as necessary, it's SO much easier to just have a simple, obvious set of configuration variables right at the start. I'm sure it took you a lot of extra time to setup, but you've saved all of us a ton of time in return.
Here's my site, greatly enhanced by your work!
http://clan-ai.org
@seleleth - Welcome. Glad you enjoy it. :)
@Wilsy - I think I can add that pretty easily. No time tonight.. maybe later this week or weekend.
Hello mates,
Can anyone help me, how I can add that block?
Tnx,
JimKarvo
@JimKarvo
you have to put the code in a phpbox.
@Thurnok : Thanks for your masterpiece man :D and the latest updates including the categories i asked for.
Surely my favorite snippet , way too far from the second one !
Things like this make me stuck with TP
Thanks again :up:
ΑÆÎÂλεια μοÃ…
Tnx Gourgi! But first I have to upload some photos :-P
One question! How I can have up of 1 random photo in block?
@Thurnock - Thank you :)
Regards,
Wilsy.
@JimKarvo
Take a look inside the actual code. You will find numerous configuration variables there that you can set as you desire. I always recommend copying the code to your favorite text editor to actually "view" the code before putting it into the TP Block itself. It's much easier to view it in your favorite editor than it is in the small "textarea" of the Admin Control Panel block manager.
If you look in the code, the area you are interested is all between the following sections:
/*
****************************************
****************************************
*** !! Admin Config Section !! ***
****************************************
****************************************
*/
all the goodies for you to set are in here
/*
****************************************
****************************************
*** !! END Admin Config Section !! ***
****************************************
****************************************
*/
Each variable is commented relatively well to tell you its purpose and options. The one in particular you asked about is:
// ***** LAYOUT OPTIONS *****
// how many pictures do you want to show?
$gal_numpics = 1;
Simply change the number to the number of pictures you want displayed in your block. You can also change how many columns you want your pictures displayed in via another variable in that section. I'll let you try to find it now that I've explained it pretty well.
In fact, I recommend you play with all the various configuration variables so you can see what each does. I suggest you open two browser windows (or Tabs) for your site pointing one to your admin control panel - in specific the TP Block Manager and your block, and the other the home page of your site (or wherever you are displaying the block). Change a setting, save the block, then refresh the window that is displaying the block to see what it does.
Hi Thurnock,
Quote@Wilsy - I think I can add that pretty easily. No time tonight.. maybe later this week or weekend.
Did you manage to take a look? :)
Regards,
Wilsy.
Didn't get a chance over the weekend, but did tonight. Think you will pleasantly find what you are looking for in the first post. ;)
Update 1.6
- Added abililty to display pics for a member who's profile you are viewing.
Code in first post. Don't forget to read the Profile Note in first post. All features work the same (random, most/least, newest/oldest, numpics, numcolumns, etc) for this new Profile feature, but added a link to display all pics for the member in the block at bottom.
For a demo of this new feature, go to my TP Blocks site (http://www.tpblocks.com) (registration required to view member profiles), and view Maya's profile.
says i cant just view any profile when i try, i did register
@Mannie - woops... hehe.. try again ;)
@babjusi - welcome :)
Update 1.7
- Added option to display pics from members on your buddy list
When this is enabled ($gal_buddies = 1) then only pics from members on your buddy list are displayed in the block. All other options remain in effect (random, newest/oldest, most/least, order, numpics, numcolumns, etc).
Code in first post. Don't forget to read Buddy List Note in first post!
Update 1.7.1
- quick fix to the url parsing in 1.7, will work properly in articles now
woopsie... now view all buddy pics link goes to the right place if you have the code in an article... sorry
Hey
The updata code is in the first place ???
Yes, updated code is always placed in the first post in this topic, along with any description/info for the block.
:)
To view how the Buddies pics works, go to my TP Blocks site (http://www.tpblocks.com) (register if you are not already) and click the My Buddies Pics link in the Main Menu.
Awesome, Thanks for telling me that :)
Quote from: Thurnok on May 10, 2007, 04:02:43 AM
To view how the Buddies pics works, go to my TP Blocks site (http://www.tpblocks.com) (register if you are not already) and click the My Buddies Pics link in the Main Menu.
Alright, I join your forum and I see what it done and the code is pretty neat to use
Edited --
@Thurnok -I wanna to have the code set up like you have on your site. Can you do it for me ??? If you dont mind at all
I will give you rights for Admin to get in the Admin Panel. Because I dont know how to set it up like you have it on yours site
Oh that's basicly the same as the hack i allready use from smfhacks, probably this is easier to put in ;)
Actually, its a new feature to my SMF Gallery Random Pic block (which has been out for quite some time now). If you take a look at the code comments, you will see the other features that have been in that block for a long time.
With this block, you can have as many blocks as you want each with different configurations to suit you as you please. Try it out if you like, its as easy as copy/paste the code into a TP phpblock. :)
I know what the block is hehe been using it for some time. What i mean was the images on the profile screen ;)
Quote from: Mannie on May 11, 2007, 06:33:02 AM
I know what the block is hehe been using it for some time. What i mean was the images on the profile screen ;)
I think that this is taken in consideration for the feature releases of TP, but don''t qoute me on this as I may have heard it wrong
Thanks to Thurnock we now have member profiles with images - awesome work and I for one am really grateful ;D
Can I now give a shameless plug to a request made some time ago for a search facility which would sooooo much compliment Thurnocks new profile images block: -
http://www.tinyportal.net/index.php?topic=14919.0
Regards,
Wilsy.
I put this code snippet inside a php block in TP, and I get this error:
Parse error: syntax error, unexpected $end in /home/ottmoto/public_html/Sources/Load.php(1752) : eval()'d code(35) : eval()'d code on line 255
Quote from: Thurnok on December 01, 2006, 09:32:24 AM
(Note: new features in red)
What it is:
This block displays random, newest, oldest, most/least viewed or commented picture(s) from your SMF Gallery mod inside a block of your choice. Actually, it displays the thumbnail and links to the full picture.
Type of block:
This is a phpblock. It can be any block/article position (left/right/center/front/article). If you use it in a left/right block, you should set the columns to 1. If you use a center/frontpage/article block, then set the columns to however many you want.
This block snippet can be used in multiple simultaneous blocks using the same or different configuration settings in each without issue.
Features:
- configurable number of pictures to display
- sort order to display newest/oldest or most/least pics
- configurable number of columns to display the pictures in
- enable title display (if viewer is picture poster, it becomes a link to edit the picture)
- displayed thumbnail links to full picture from the gallery
- enable display of picture poster (links to their profile)
- enable display of date posted
- enable display of category picture is in (links to that gallery category)
- enable display of number of views
- enable display of picture dimensions (width X height)
- enable display of picture's filesize
- enable display of picture's description
- can disallow pictures from various categories
- can allow pictures only from various categories (disallowed cats override)
- only displays approved pictures
- configurable to require allowedTo('smfgallery_view') permission or not for viewing thumbnail
- display pics posted by a member who's profile you are viewing, in the profile screen (see profile note) - added in ver 1.6
- display pics posted by members in your buddy list - added in ver 1.7
Profile Note: You must enable panels (blocks) for the profile screen via TinyPortal -> Settings -> Panels -> Hide panels when in these sections: -> Profile screen: No
Buddy List Note: This will work everywhere except under the following condition:
- you have the option to display profile pics turned on in an SMF Gallery Random Pic block that displays while in the profile screen, and you are currently viewing some member's profile.
In otherwords, the Profile pics display will override the buddy pics display in that case. If this same block however, displays on other pages (frontpage, forum, etc) then the buddy pics will display in the block when on those pages!
See the Admin configuration section in code for each configuration variable.
////////////////////////////////////////////////////
// SMF Gallery Random Picture - ver. 1.7.1 //
////////////////////////////////////////////////////
//
// Developed by Thurnok
// Thurnok -AT- tinyportal .DOT. net
// November 30, 2006
//
// Updated 5/9/2007
// 1.7.1
// - quick fix to parsing the url
//
// Updated 5/9/2007
// 1.7
// - added option to view pics that members on your buddy list posted
//
// For list of all previous updates history, see the UPDATES.TXT attached file
// in the post where you got this code, or the .ZIP file if you downloaded it
//
// Used in a TinyPortal phpblock or Article.
// This block displays random picture(s) from
// the SMF Gallery mod along with other information
//
//////////////////////////////////////////////
global $scripturl, $db_prefix, $modSettings, $boardurl, $ID_MEMBER, $user_info, $context;
/*
****************************************
****************************************
*** !! Admin Config Section !! ***
****************************************
****************************************
*/
// ***** LAYOUT OPTIONS *****
// how many pictures do you want to show? 0 = all!
$gal_numpics = 1;
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;
// enable profile pics display?
// 0 = disable, 1 = enable --- if enabled, and you are viewing a member profile, show pics from that member only
// other options still apply (showtype, sort order, etc)
$gal_profile = 1;
// only show pics from buddies?
// 0 = disable, 1 = enable --- if enabled, will only show pics posted by members in your buddy list
$gal_buddies = 0;
// 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 = 1;
// 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 = 1;
// display number of views?
$gal_dispViews = 1;
// display dimensions?
$gal_dispDimensions = 1;
// display filesize?
$gal_dispSize = 1;
// 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 = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
/*
****************************************
****************************************
*** !! 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";
// get this user's buddy list
$gal_buddylist = implode(",", $user_info['buddies']);
// prep for our switch routine
if (empty($gal_showtype))
$gal_showtype = 0;
// sort text
if (empty($gal_sort)){
$gal_sort_text = 'DESC';
} else {
$gal_sort_text = '';
}
// are we viewing a member profile and $gal_profile is enabled?
if (!empty($gal_profile) && strtolower($context['current_action']) == "profile"){
$gal_member = empty($_GET['u']) ? $ID_MEMBER : $_GET['u'];
}
// 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,
commenttotal,
ID_CAT
FROM '.$db_prefix.'gallery_pic
WHERE approved = 1
'.(empty($gal_member) ? (empty($gal_buddies) ? "" : (empty($gal_buddylist) ? "AND ID_MEMBER = NULL " : "AND ID_MEMBER in ($gal_buddylist)")) : "AND ID_MEMBER = $gal_member" ).'
'.(empty($gal_disallowCats) ? "" : " AND ID_CAT NOT IN ($gal_disallowCats)").'
'.(empty($gal_allowCats) ? "" : " AND ID_CAT IN ($gal_allowCats)").'
GROUP BY thumbfilename ';
switch ($gal_showtype){
// most/least recent
case 1:
$gal_query .= '
ORDER BY date '.$gal_sort_text;
break;
// most/least viewed
case 2:
$gal_query .= '
ORDER BY views '.$gal_sort_text;
break;
// most/least commented
case 3:
$gal_query .= '
ORDER BY commenttotal '.$gal_sort_text;
break;
default:
$gal_query .= '
ORDER BY rand() '.$gal_sort_text;
break;
}
$gal_query .= (empty($_GET['gal_viewall']) && !empty($gal_numpics)) ? ' 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_dispDate)){
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";
if (!empty($gal_member) && empty($_GET['gal_viewall']))
echo '<br /><a href="'.$boardurl.'/index.php?action=profile;u='.$gal_member.';gal_viewall=1">View all pics from this member</a>';
if (!empty($gal_buddies) && empty($_GET['gal_viewall'])){
// build the link
$gal_querystring = $context['TPortal']['querystring'];
$gal_querystring .= empty($gal_querystring) ? 'gal_viewall=1' : ';gal_viewall=1';
echo '<br /><a href="'.$boardurl.'/index.php?'.$gal_querystring.'">View all pics of buddies</a>';
}
}
} else {
echo 'Sorry, you do not have permission to view pictures!';
}
Damn I am so GLAD I found TP.... you guys are GREAT. I have added so many cool options that fit my board. I got the Calendar TP mod last night now this one.!!!
YOU GUYS and GALs keep up the great work!!!
How or where do I get the category numbers?
You can click the gallery link on your site, and the categories should be displayed. Just hover your mouse over the category name links and look at the URL in the status bar of your browser. It should have at the end of the url something like: cat=<cat number> Example ( cat=4 ).
Or you can also go to the SMF Admin Control Panel, select Gallery Configuration, and then Manage Gallery to do the same thing.
Great stuff
Clever man
hats off to you fella thanks
nice mod...
i have this installed to just display the image only but i get some url related text in the block which shouldn't be there. any ideas on how to remove it.
thanks
PS my site is : http://test.ihf.lp.pl
bump..any ideas how to remove it?
Can you post a screenshot of the error/url text?
yes...here is an attached png file
bump...any ideas?
That is BBC code. There is no BBC code in the block code, so you have something eroneous in your block somewhere.
Try clearing the block, then copy/paste the original block code there and use the defaults just to see if you have the same situation. Then change config items down to the same config you currently have.
ok...thanks that helped...i learnt that i shud quote the "code" and copy it from teh "post" box so i get all of it and dont get added BBC code
thanks all works now
hi
I have smf gallery
www.albahala.com/gallery
I copy the block in phpbox and activated it
but it gave me this msg
Error, no database found!
Does the gallery work properly on your site ?
A link is good for us to see for our selfs
Hi,
I use the script at Brokeassgames.com
as you see, its up on the top over the articles.
The articles are not showing up via a articlebox, rather in TinyPortal Config as featured documents.
The thumbnails are not showing, and i cannot get it to float to the bottom
Any Help Here?
Works like a charm so far...thanks. :)
@Laos - I went to your site, but I do not see a block for random pix anywhere.
how can I center this in a left block? It seems to put the picture a little off center.
Also, when selecting to show 'posted by user' and including date, it doesn't format it correctly... it doesn't break causing it to appear as a run-on. Is there any way to format it so when you choose these options there it appears something like:
Posted by:
username
on June 1, 2007
instead of:
Posted by username on June
1, 2007
Otherwise, this is very nice. Good work!
Great, great stuff this mod. Are u gonna add a slide show option, please? Be great to have that. :)
@vdubbia
The reason it displays the way it does is because all of the following options are available depending on how you configure it:
- Posted by username
- Posted on date
- Posted by username on date
Rather than add some extra logic, I simply shortcutted it. I'll look at modifying that in the next update.
@Ibexy
Good possibility. Just been too busy with RL work to do much updating, but I had thought about it. Watch for the new features in the next update.
thanx man i really apretiat that
hi! can we see a live demo for this?
Live Demo (http://www.mykimbrell.com/BiancasBuddies/index.php)
very nice mod! thanks!!!!!!!!!!!! :) worked!
Is possible to create a Top 5 voted by category block? Please split if this is another topic.
A while back i asked for support and i took it down, its back up, and the same issue i mentioned, no thumbnail, take a look
brokeassgames.com
Hi,
I am following up on Laos's post above. We put our broken 'random pics' block back on our main page. Seems to be set up right, it ties to the gallery and shows the text info for the pics, just no thumbs. Also, when you click one of the text peices it takes you to a page that should show the pic, but it doesn't. Any help to get this right would be appreciated.
Jondo - BrokeAss Games
http://www.brokeassgames.com/Community/index.php (block on bottom left)
Anyone help with this error message:
Parse error: syntax error, unexpected $end in /home/capital/domains/capitalbocking.co.uk/public_html/bockersworld/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 255
I've literally copy and pasted the code from the first post into a new php block.
Copy and paste the entire code again, make sure you get everything from the code box before you paste it in a php block.
I have used this code so many times i know it's nothing wrong with it.
So redo the block again and test.
i used this block for the first time and i noticed that it showed the username of the poster (the one used to login) instead of the real name (the one shown in posts and other members . i replaced this
// 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>';
with this
// display the membername who posted pic? need to get name based on ID_MEMBER
$gal_tmp = mysql_fetch_assoc(mysql_query("SELECT realName FROM ".$db_prefix."members WHERE ID_MEMBER = ".$row['ID_MEMBER']));
echo ' by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$gal_tmp['realName'].'</a>';
and it worked just fine ! i am not a coder , just experimenting , so i have to ask , is that ok ?
i also have 2 questions : how do i change the dimensions of the thumbnail shown in the block , and , how do i change the language of the pic posting date shown in the block (it shows english while everything else is in greek) ?
thnx in advance !
how to edit the code to have latest image in a specific/particular gallery category?
thanks
about the date thing , i replaced this
// display the date it was posted
echo ' on '.date("d M Y", $row['date']);
}
with this
// display the date it was posted
echo ' σÏ,,ιÏ, ' . timeformat($row['date']);
}
and it worked !
one more question : is there a way to change the color of the link of the poster's name so that it's the same with the one chosen member color link ?
I think the color of the links is controlled with the style.css file.
a:link and a:visted etc.
thnx a lot IchBinâ,,¢ , any ideas about the dimensions of the thumbnail ? is there any way i can change them ?
Quote from: MYBESTHOMESnet on October 01, 2007, 02:11:36 AM
how to edit the code to have latest image in a specific/particular gallery category?
thanks
it's easy i think ! (as i previously said i am not a coder , so if anyone knowing coding sees anything wrong please advice !)
just replace this
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
with this
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 1;
that will show the last pic added in your gallery ! now if you want it to show the last pic added in a specific category you have to replace this
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
with this
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "4";
assuming off course that 4 is the number of the category you want the block to show . an easy way to find out what's your category number is to go to your gallery and click on the link of that category and check the url address of your browser , it should be something like
http://www.yoursite.com/index.php?action=gallery;
cat=4
This is awesome...it's only taken me about 2 hours to find it and a lot of reading through posts at the SMF forum.
Great stuff!
Glad you like it Rabain!
Let us see a link when you get it setup. :up:
Works awesome, I was creating a script do to the same thing until I found the list of block code snippets. So glad I did. :)
Quote from: MinasC on October 01, 2007, 01:46:13 AM
i used this block for the first time and i noticed that it showed the username of the poster (the one used to login) instead of the real name (the one shown in posts and other members . i replaced this
// 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>';
with this
// display the membername who posted pic? need to get name based on ID_MEMBER
$gal_tmp = mysql_fetch_assoc(mysql_query("SELECT realName FROM ".$db_prefix."members WHERE ID_MEMBER = ".$row['ID_MEMBER']));
echo ' by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$gal_tmp['realName'].'</a>';
and it worked just fine ! i am not a coder , just experimenting , so i have to ask , is that ok ?
MinasC, thanks for posting this. I was just sitting down to try and figure out how to do the same thing when I found your post. It's been working fine for me on two sites.
you are welcome !!!
Hi, I'm italian boy, sorry for my english.
I admin http://www.drz-italia.com.
I create php central block and I paste into SMF Gallery Random Picture code, but I can't view the latest pics.
Thanks.
I am loving this and have installed it on my forum. Many thanks for all your hard work :)
I was just wondering if there is a way to turn off the click on thumbnail option (to see larger images) Please
I also have this and think its great. My only request would be an option to see if comments had been added.
Quote from: yllas on October 22, 2007, 05:48:36 PM
I am loving this and have installed it on my forum. Many thanks for all your hard work :)
I was just wondering if there is a way to turn off the click on thumbnail option (to see larger images) Please
I think i've found the right part to edit,
// 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";
but am unsure what to do next ??? please advise :-*
if you just remove the linking part it should be ok !!! replace the code you posted with this one .
// display the picture thumbnail and link it to gallery full picture
echo ' <img src="'.$modSettings['gallery_url'].$row['thumbfilename'].'" /><br />'."\n";
MinasC you are a Star...many thanks for helping me :up: it works like a dream
don't even mention it man , glad i could help !
This is a great snippet, perfect for my site!
A+++++++
Great work!
outstanding! thank you...
is there any code to run with scriptbox or javascript?
Why can't you use a php box?
Quote from: IchBinâ,,¢ on November 06, 2007, 04:37:40 PM
Why can't you use a php box?
i want to put it in yahoo style tab, i think that tab using javascript. so can i combined/add it with PHP?
I don't think there is any javascript code for this.
can i have the own background for this block...?
You can add a background to the table if you'd like.
echo "\n".'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%">'."\n";
Either assign a class with a background that you've created, or add the background property of the table.
Quote from: IchBinâ,,¢ on November 07, 2007, 04:46:59 PM
You can add a background to the table if you'd like.
echo "\n".'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%">'."\n";
Either assign a class with a background that you've created, or add the background property of the table.
where must i put my image url?
and where must i put this code..
very sorry for a alot of question here...
You can't make a background image a URL.
can u clearly tell me where must i put this code? and what must i change?
As I stated before, you CANNOT make a background image a link.
can u tell me what must i put after this
echo "\n".'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%">'."\n";
to put my style background from my style css
How to do it with CSS:
http://www.w3schools.com/css/css_background.asp
How to do it with HTML tables:
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_background
or
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_cellbackground
Both of these were within the first 3 results of a google search. Don't forget to use google mate. :)
I just installed SMFgallery lite on SMF 1.1.4 and TP 0.9.8 and wanted to use this nice block, but I get a strange error message. I looked through this thread and the forum, but I couldnt find any solution. Can anyone help me with that?
MySQL error:Access denied for user 'wwwrun'@'localhost' (using password: NO)
I copy->pasted it exactly like it is and took care that I didnt miss anything. Also I did not change anything in the code. :-\
Thx in advance for your efforts.
Here is a link to our website with the nonworking block:
http://internationalchaos.com/
Quote from: Bombes on November 18, 2007, 01:56:51 AM
I just installed SMFgallery lite on SMF 1.1.4 and TP 0.9.8 and wanted to use this nice block, but I get a strange error message. I looked through this thread and the forum, but I couldnt find any solution. Can anyone help me with that?
MySQL error:Access denied for user 'wwwrun'@'localhost' (using password: NO)
I copy->pasted it exactly like it is and took care that I didnt miss anything. Also I did not change anything in the code. :-\
Thx in advance for your efforts.
Here is a link to our website with the nonworking block:
http://internationalchaos.com/
That is an authentication error, check settings.php that the username and password for your MySQL database is ok. Alktough by the look of it, user wwwrun doesn't have a password set...
As far as I can see all settings are correct. :-\ Checked settings.php as well as database. Still not working.
only thing I can think is that the username or password is incorrect, or some of your files/folders have the wrong chmod permissions.
Ive used the code for a period of time now, more recently with 1.1.4 and TP .98. Ive had errors appearing in my forum log but as the code had been seemingly working ok, I have ignored them.
For completeness however and my continued annoyance at the errors I'll throw this in:
"8: Undefined index: smfgalleryprofile_title
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 399"
"8: Undefined index: smfgalleryprofile_viewall
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 410"
These errors are repeated time and time again.
Whats happening here?
Those are actual errors with the gallery, and not the code snippet I think.
is there any way to show the member's name who posted the picture , using the member's color ?
QuoteIve used the code for a period of time now, more recently with 1.1.4 and TP .98. Ive had errors appearing in my forum log but as the code had been seemingly working ok, I have ignored them.
For completeness however and my continued annoyance at the errors I'll throw this in:
"8: Undefined index: smfgalleryprofile_title
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 399"
"8: Undefined index: smfgalleryprofile_viewall
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 410"
These errors are repeated time and time again.
Whats happening here?
Well this is weird, it's said here that this is a gallery error but over there they say it is this mod's error, what now?
I have made a small tweak to this to display the realName instead of the userName.
Why?
On boards where users can change their displayed name in their profile the username can be different to the displayed name (realname).
////////////////////////////////////////////////////
// SMF Gallery Random Picture - ver. 1.7.1 //
////////////////////////////////////////////////////
//
// Developed by Thurnok
// Thurnok -AT- tinyportal .DOT. net
// November 30, 2006
//
//
// Updated 1/12/07 by nokonium
// 1.7.1 version with realName
// - shows realName instead of membername
//
// Updated 5/9/2007
// 1.7.1
// - quick fix to parsing the url
//
// Updated 5/9/2007
// 1.7
// - added option to view pics that members on your buddy list posted
//
// For list of all previous updates history, see the UPDATES.TXT attached file
// in the post where you got this code, or the .ZIP file if you downloaded it
//
// Used in a TinyPortal phpblock or Article.
// This block displays random picture(s) from
// the SMF Gallery mod along with other information
//////////////////////////////////////////////
global $scripturl, $db_prefix, $modSettings, $boardurl, $ID_MEMBER, $user_info, $context;
/*
****************************************
****************************************
*** !! Admin Config Section !! ***
****************************************
****************************************
*/
// ***** LAYOUT OPTIONS *****
// how many pictures do you want to show? 0 = all!
$gal_numpics = 1;
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;
// enable profile pics display?
// 0 = disable, 1 = enable --- if enabled, and you are viewing a member profile, show pics from that member only
// other options still apply (showtype, sort order, etc)
$gal_profile = 1;
// only show pics from buddies?
// 0 = disable, 1 = enable --- if enabled, will only show pics posted by members in your buddy list
$gal_buddies = 0;
// 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 = 1;
// information display flags (0 = No, 1 = Yes)
// display picture title?
$gal_dispTitle = 1;
// display realName who posted pic?
$gal_dispMember = 1;
// display posted date?
$gal_dispDate = 1;
// display category the picture is in?
$gal_dispCategory = 1;
// display number of views?
$gal_dispViews = 1;
// display dimensions?
$gal_dispDimensions = 1;
// display filesize?
$gal_dispSize = 1;
// 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 = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
/*
****************************************
****************************************
*** !! 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";
// get this user's buddy list
$gal_buddylist = implode(",", $user_info['buddies']);
// prep for our switch routine
if (empty($gal_showtype))
$gal_showtype = 0;
// sort text
if (empty($gal_sort)){
$gal_sort_text = 'DESC';
} else {
$gal_sort_text = '';
}
// are we viewing a member profile and $gal_profile is enabled?
if (!empty($gal_profile) && strtolower($context['current_action']) == "profile"){
$gal_member = empty($_GET['u']) ? $ID_MEMBER : $_GET['u'];
}
// 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,
commenttotal,
ID_CAT
FROM '.$db_prefix.'gallery_pic
WHERE approved = 1
'.(empty($gal_member) ? (empty($gal_buddies) ? "" : (empty($gal_buddylist) ? "AND ID_MEMBER = NULL " : "AND ID_MEMBER in ($gal_buddylist)")) : "AND ID_MEMBER = $gal_member" ).'
'.(empty($gal_disallowCats) ? "" : " AND ID_CAT NOT IN ($gal_disallowCats)").'
'.(empty($gal_allowCats) ? "" : " AND ID_CAT IN ($gal_allowCats)").'
GROUP BY thumbfilename ';
switch ($gal_showtype){
// most/least recent
case 1:
$gal_query .= '
ORDER BY date '.$gal_sort_text;
break;
// most/least viewed
case 2:
$gal_query .= '
ORDER BY views '.$gal_sort_text;
break;
// most/least commented
case 3:
$gal_query .= '
ORDER BY commenttotal '.$gal_sort_text;
break;
default:
$gal_query .= '
ORDER BY rand() '.$gal_sort_text;
break;
}
$gal_query .= (empty($_GET['gal_viewall']) && !empty($gal_numpics)) ? ' 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 /><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 /><br />'."\n";
// display poster's name and posted date if enabled
if (!empty($gal_dispMember) || !empty($gal_dispDate)){
echo 'Posted';
if (!empty($gal_dispMember)){
// display the realName who posted pic? need to get name based on ID_MEMBER
$gal_tmp = mysql_fetch_assoc(mysql_query("SELECT realName FROM ".$db_prefix."members WHERE ID_MEMBER = ".$row['ID_MEMBER']));
echo ' by <a href="'.$scripturl.'?action=profile;u='.$row['ID_MEMBER'].'">'.$gal_tmp['realName'].'</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";
if (!empty($gal_member) && empty($_GET['gal_viewall']))
echo '<br /><a href="'.$boardurl.'/index.php?action=profile;u='.$gal_member.';gal_viewall=1">View all pics from this member</a>';
if (!empty($gal_buddies) && empty($_GET['gal_viewall'])){
// build the link
$gal_querystring = $context['TPortal']['querystring'];
$gal_querystring .= empty($gal_querystring) ? 'gal_viewall=1' : ';gal_viewall=1';
echo '<br /><a href="'.$boardurl.'/index.php?'.$gal_querystring.'">View all pics of buddies</a>';
}
}
} else {
echo 'Sorry, you do not have permission to view pictures!';
}
Quote from: MinasC on November 25, 2007, 03:38:06 AM
is there any way to show the member's name who posted the picture , using the member's color ?
any ideas on that ? gallery itself uses member's color in the section "who's viewing a pic" but i couldn't find a way to do the same in my fallery random pic block ! :(
anyone ?
Awsome just what I was looking for, any possible way to add a search to the code aswell, I am using this block as a front page block and would be nice to have a search right on top of the front page as well.
finally found it then :P
i didn't see a response to changing the dimension of the displayed thumbnails...
...can anyone answer that one for me if possible?
Im using the code in the 1st post.
Is there a way to change the display size to 568x426 pixels to use on a center block?
...say...instead if grabbin the thumbnail size,maybe the size of the image itself?
Right now is on a left block and the image is displayed small. I'd like to change the size.
Works great, thanks for the code! Woo hoo! :up:
How to use this as an SSI function?
Worked like a charm. Rock on Thurnok!
Quote from: bluedevil on January 14, 2008, 09:01:48 PM
Im using the code in the 1st post.
Is there a way to change the display size to 568x426 pixels to use on a center block?
...say...instead if grabbin the thumbnail size,maybe the size of the image itself?
Right now is on a left block and the image is displayed small. I'd like to change the size.
Anyone want to take a whack at this quote?
i didn't see a response to changing the dimension of the displayed thumbnails...
...can anyone answer that one for me if possible?
As far as I could tell the gallery is what sets the size of the thumbnail.
QuoteAs far as I could tell the gallery is what sets the size of the thumbnail.
You are correct, had the same question a while back, SMFHacks had all the info on that ( where the mod comes from )
Sorry.. been on Hiatus for 6+ months... here are some answers to recent questions - even if some are a few months old ;)
@Rafferty - The undefined errors you were receiving are from the SMF Gallery MOD - this thread deals with the TP Block that "uses" the MOD. So when you say "Well this is weird, it's said here that this is a gallery error but over there they say it is this mod's error, what now?" - I assume by "over there" you mean at Simple Machine Forums - and they are correct... it is a problem with the MOD. And when we here say it is a problem with the Gallery, we mean the Gallery MOD which was neither written here, nor at SMF, but instead at SMF Hacks.
@ MinasC - Yes, there is a way to show the member color, it just hasn't been added to the block code -- see top of this post ;)
@ Jippo - There are already search capabilities provided by SMF and TP, you should be able to simply add them to your frontpage. Unless you are talking about searching for gallery pics. That would instead have to be added to the block.
@~Alex / Bluedevil - The thumbnail size is dictated by the SMF Gallery Mod. Adding a dynamic thumbnail size to the block would take some looking into, which I don't currently have enough time to do, but may in the future when I'm back to a normal schedule.
This block has been around for quite awhile, and I haven't done any changes in numerous months, not sure if there is any real need to do any at this point until I'm fully back "in the game" so to say. But if you still have feature requests, post them up.
woooohooooo....many thanks to you!!
Quote from: Thurnok on February 10, 2008, 05:08:22 AM
@ MinasC - Yes, there is a way to show the member color, it just hasn't been added to the block code -- see top of this post ;)
thnx a lot for the answer ! plz consider this a request !
Sorry to be a pain Thurn, yep my bad. It was over at SMF they said it was the code I'm using in the snippet, at hacks he said it was SMF and here ya say its the gallery. No wonder Im confused.
No pain whatsoever Rafferty.
Yea, it can be confusing when you are dealing with 4 different pieces to the puzzle. SMF being the "base" piece, since it is the forum software, TP being another "rather big piece" since it is a Portal "mod" to SMF - and therefore a large integral piece to anyone's site that has SMF/TP installed, and then the Galler mod which, just like Tiny Portal, is a mod to SMF as well, though smaller in terms of a site's "perception", and finally the SMF Gallery Random Picture block code which is miniscule in comparison to any of the other three.
Going off of the errors you posted:
Quote from: Rafferty"8: Undefined index: smfgalleryprofile_title
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 399"
"8: Undefined index: smfgalleryprofile_viewall
File: /home/www/xxxxxxx.org/forum/Themes/default/languages/Gallery.english.php (eval?)
Line: 410"
These are indeed errors "detected" by SMF but they point to an issue with the SMF Gallery mod (based on the variable names at issue). Most likely they are due to a corrupt or incorrectly installed SMF Gallery mod, or a version of the mod that may have had problems or simply needs a fix. Those particular variables (smfgalleryprofile_title and smfgalleryprofile_viewall) are not in SMF, TP, nor the SMF Gallery Random Picture block code, they only come from the SMF Gallery mod itself.
Thank you very much, your a gentleman and a scholar lol, appreciate the explanation. I'll go chasing.
Thurnok, thanks a lot for this fab bit of code and also for pointing me in its direction ...
Amazing bloc .... love it - thank you!
Wow I am impressed because even I could do this and figure out how to change the script to how I wanted it. I never thought that I would be doing that.
Thank you so much for a wonderful very easy to follow description of how to do it.
Welcome to all.
I try to make my block code as readable and easy to modify as possible since you generally have to make changes right in the code to configure things (for any block code). So I hope its as easy for anyone else too. :)
I'd like to know if the # of comments made about the photo can be added in with a link to take you to the comments of that particular picture.
Great script, thank you.
Quote from: insanemustang on May 07, 2008, 06:28:46 PM
I'd like to know if the # of comments made about the photo can be added in with a link to take you to the comments of that particular picture.
Great script, thank you.
anyone?
It's very likely possible. The trouble is that, before anyone can write code that accesses the information created by any modification, the coder has to have the mod installed. There are some small things that I don't mind installing on my test site, but some are just too involved for me to do. The gallery would require not only installing the mod, but also adding images and having people comment on them.
Possibly someone who has the mod installed on their site can help you.
Hum... seems reasonable. Maybe someone else can help... if not I will get with you and set you up an account on my website... that is... if you are trustworthy >:D
The answer is "yes". However, modification to the underlying code is necessary to pull the information from the database and then act on that. I've added it to my "to-do's" but it might be awhile before I get back into modifications to my various block codes (due to recent events). Anyone else is free to take a stab at it however. It is not a very difficult addition.
Good to see you Thurnok, we've been missing you. :up:
I admit this code is quite useful, I used it to customize my own version of the modification, however... That is not the proper way to execute a mysql query in PHP. The code introduces a memory leak.
You are executing a query, fetching a single row, but you don't free up any of the memory that was used the execute the query. You have the store the result of the query in a variable, then use the mysql_fetch_assoc function. After you are done with the query results you MUST call mysql_free_result on the query result variable.
I think you need to review the code again, or ensure you are looking at the full code. There is in fact a mysql_free_result for the resource I fetch with my query. It is near the end of the code.
Perhaps you are looking at someone's small subset of the code when they were asking a question? I'm not sure what code you were looking at, but you will find the full code in the first post in this thread.
By the way, I didn't mention it, but I might as well for those out there that may not know...
mysql_free_result() is actually NOT required as ccbtimewiz tries to indicate. All result sets from mysql_query()'s are automatically freed at the php script's execution end. It is good practice however, to use it (as I ALWAYS do), and also it helps if you are making multiple result sets that are very large, since they all take up memory "during" the script execution.
okay I can't help you with the code, but wanted to say thank you for the block, it works perfect on my site :) :up:
Quote from: Thurnok on June 04, 2008, 11:49:17 PM
I think you need to review the code again, or ensure you are looking at the full code. There is in fact a mysql_free_result for the resource I fetch with my query. It is near the end of the code.
Perhaps you are looking at someone's small subset of the code when they were asking a question? I'm not sure what code you were looking at, but you will find the full code in the first post in this thread.
I'm looking at the code in the first post. ^^'
Quote from: Thurnok on June 05, 2008, 12:04:36 AM
By the way, I didn't mention it, but I might as well for those out there that may not know...
mysql_free_result() is actually NOT required as ccbtimewiz tries to indicate. All result sets from mysql_query()'s are automatically freed at the php script's execution end. It is good practice however, to use it (as I ALWAYS do), and also it helps if you are making multiple result sets that are very large, since they all take up memory "during" the script execution.
mysql_free_result($gal_result);
^ You can't call the function on an array. Only reason to why the error log isn't showing this error is because SMF is most likely deallocating the array.
What drugs are you on exactly?
You even put a code snippet of my call to free the resource above.
Snippet of my code from the first post in this thread:
$gal_result = mysql_query($gal_query);
.
.
.
<various other stuff here>
.
.
.
mysql_free_result($gal_result);
$gal_result is NOT an array. It is a variable of type RESOURCE returned from the mysql_query() function. I'll direct you to the PHP website's own reference to help you better understand php: http://www.php.net/manual/en/function.mysql-free-result.php
Oh... and there is no error in SMF because, well... there is no error.
Ah.... I see. Never seen code written that way before. =T
Can you add links to view gallery and to add a picture? I attempted to add the html and I got a nice parse code because I suck.
Thanks!
I think I partially understand what you are asking.
Try taking a look at another piece of block code here:
http://www.tinyportal.net/index.php?topic=14235.msg119054#msg119054
That's cool ... but ideally I'd just like links right under the random picture gallery that give the user a click able link to view gallery or add a picture.
Now I will show you my awesome artistic abilities!
---------------------
| (x's are pictures) |
| x x x x x x |
| |
| "view gallery" |
| "add picture" |
----------------------
Thanks
Not sure I see the point in a link for "View Gallery" as you probably already have that in your menu, plus any picture they click on will show them that picture inside the SMF Gallery's picture view page that also has a link to the main gallery page. Seems like it would be overly redundant to me. But, you could simply add the link in the code to display at the bottom of your block.
The "add picture" link could also simply be added at the bottom of the block, though if they do not have rights to add pictures, SMF Gallery probably will display a message to such. If you only wanted the "add" link to be displayed to users that have permission to add pictures, that would need to be added to the actual code.
Here's something odd. When I have a "Copperminefetch" block and a "SMF Gallery Random Picture" block on the front page at the same time the SMF GRP block does not display, and displays this error:
MySQL error:Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
The error goes away when I remove the Copperminefetch block. I'd like to have both boxes on the page at the same time, but what do I need to do? Thanks in advance for any help.
Here's the link. www.remedydog.com
Sorry, but I do not have Coppermine, so I have no idea how it is setup in SMF. Also, due to this, I do not have the Copperminefetch block. And since I'm not the author, I'd say you are better off asking the author of that particular block. It sounds like something in the Copperminefetch block, but that's not to say it couldn't be something in Coppermine itself, or its setup.
Can we adjust the thumbnail size??? this blocks works fine. Just wanted to make the Thumbnail bigger.
:D
Perfect works really good on my one www.zunft-hyboriens.de.
Same questeion as above - any option to have a little bigger thumbnails ?
The block currently uses SMF Gallery's own thumbnails. So the size is set by SMF Gallery. I've included the request on the wish list for a future release however.
You need PRO edition to set Thumbnails unfortunately....
Can someone assist me on fixing this error?
"2: mysql_query() [<a href='function.mysql-query'>function.mysql-query[/url]]: A link to the server could not be established
File: /home/content/j/u/m/html/forums/Themes/default/TPortal.template.php (tp_below sub template - eval?)
Line: 176:"
Thanks in advance.
Its trying to run a query, but you don't have a connection to the DB for some reason. I would speak to your host about this.
Thanks for responding. Everything seems to be working on the site. What issues could this possibly be posing that may be lurking behind the scenes? How urgent is this to be repaired? Thanks again.
Behind the scenes? I don't know why there would be anything like that. How urgent to get this repaired? Isn't that something you should be answering? lol ITs a HOST issue, and NOT a SMF or TP issue as far as I know.
If you disable the SMF Random Pic block, does the error disappear? If so, then check the block code to make sure you didn't make any typo's when configuring it.
I have installed this mod and set it all up but I only get the dreaded Red X instead of the thumbnails showing up. Any ideas would be appreciated
If you rightclick the red x and look at the properties, what does the path tell you ? Make sure the images are in that path.
Ok I had a look at this and I don’t have thumbnails in that folder at all. If I remove the thumb_ from in front of this the image displays
/gallery/thumb_1_08_04_08_12_17_28.jpg
You have to contact smfhacks.com and ask them to help you with the thumnails and why you dont have any generated in that folder.
Ok thanks I have done this, sorry about the post
Quote from: DirtBike on July 29, 2008, 09:37:20 AM
I have installed this mod and set it all up but I only get the dreaded Red X instead of the thumbnails showing up. Any ideas would be appreciated
I thought I would just post the fix for this if anyone else has this problem.
I had not installed the GD extensions in my php setup
Thanks DirtBike for poting up the fix :up:
I will mark this to solved :)
nice share! just what I want
Thanks for the share Thurnok!!!
This is excellent!!!! ;)
Glad to help. :)
One of these days I'll actually get around to doing some updates I've planned for so long... hehe
Great code. I have done a search and read through the threadbut did not find my problem. I am trying to get just one gallery to show up in the front page block. I've changed the path to the gallery pics in the gallery config and moved the pictures to the correct folder but no pictures show up in the block. I would like to use two different gallery blocks (one for graphics and one for web design) to show images from two different gallery's (graphics and web design). Thanks
Sorry, I'm not sure what you mean. What do you mean by a single gallery? Are you saying you have multiple SMF Galleries installed? Or are you talking about only displaying a single gallery category vice all categories?
If you mean "categories" there is a variable in the Admin Config Section for that exact purpose and explained in the comment text of the code, as well as the first post in this thread. Look at the $gal_allowCats variable info.
I am having sort of the same problem as 100mis. I want to show only one category. It is the add on recent video for smf gallery. I think I change something in the following code but cannot figure out what. Also, how do I figure out what the category number is?
Thank you
// ***** 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 = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = ""; <-- add the category number inbetween the quotes that you want show. To get the category number you look at your URL when you're in the category, it should show in the URL.
IchBin my hero, thanks for the help.
Sorry to be such an idiot about this, but the category number is 34 and obviously I stil put it in the wrong place because it is not showing.
// ***** SECURITY CONFIGURATION *****
// do not allow the following category numbers to be displayed
// example: $gal_disallowCats = "34" - don't show categories 2, 4, or 7
$gal_disallowCats = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "34" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
Lines that start with a double forwardslash ( // ) are comment lines. They are not active code and anything you change there will have no effect. You changed a comment line, so it has no effect.
That said, you also were changing the wrong one. The $gal_disallowCats is for you to specify categories you do NOT want to show. In your case, that would be the wrong selection. You said you only want to show category 34, so you should change the $gal_allowCats line. Make sure you read the variables carefully as the two I just mentioned do the opposite things.
For your case, change the line:
$gal_allowCats = "";
to
$gal_allowCats = "34";
Be careful not to leave out the quotes surrounding the category, and also do not erase the semicolon at the end of the line or you will get errors.
Is there a way to get it to display the number of comments beneath the thumbnail?
This was actually asked for a long time back, but I have been away for awhile. I just updated it to provide the option to display number of comments with a link to the picture/comments.
Since this was a "quicky" I decided to just post it as is, however I have a "to-do" list of things for this block which I hope to take care of soon now.
fantastic, thankyou very much :)
Ive read all the posts and couldnt find the answer.
Im using Crips BlackBox theme. The random images will not show with that theme. Ive been using this mod for over a year with the default theme but want a fresh theme.
Whats involved in using this block in another theme or why wouldnt the theme call it?
tia!
Should not be any problem what so ever in any theme as the blocks follow the settings from the default theme.
You can look at it on my site, i have it on the frontpage topblock and in the forum you have the theme block to set diffrent themes to check it with.
www.familjegodis.se
What you can try to do though is to copy the tp-style.css from the default theme and paste it in your custom theme and see if it helps, but worth a try as thats the only thing i can think of that could change anything between the themes and the blocks.
Heya
Thanks for this excellent block code!
I was having trouble. Not sure it it was because of updating to SMF 2.0b4 or because it is a newer SMG Gallery version, but the images were in a different url for example:
Main image is in: http://www.dcpryzom.co.uk/forum/index.php?action=gallery;sa=view;pic=163
The thumbnail in block pointed to: http://www.dcpryzom.co.uk/forum/index.php?action=gallery;sa=view;id=163
So in the block code I had to search for sa=view;id and change it to sa=view;pic
Hope that helps anyone :)
Where are the images that are broken?
Quote from: Final60 on November 25, 2008, 11:27:08 PM
Heya
Thanks for this excellent block code!
I was having trouble. Not sure it it was because of updating to SMF 2.0b4 or because it is a newer SMG Gallery version, but the images were in a different url for example:
Main image is in: http://www.dcpryzom.co.uk/forum/index.php?action=gallery;sa=view;pic=163
The thumbnail in block pointed to: http://www.dcpryzom.co.uk/forum/index.php?action=gallery;sa=view;id=163
So in the block code I had to search for sa=view;id and change it to sa=view;pic
Hope that helps anyone :)
If you've updated to SMF 2.0 then you will find that TinyPortal will not work with that version of SMF... it's the same for block codes I think. :)
not sure but it looks like portamx without the copywrite.. :o
Final60 It have come to our attention that you have removed the copywrite for the theme you are using on your site BlackRainV2
I will have to ask you to add that back to the theme even if you have alterd the template and added your own header.
It's better and more polite to add in the copywrite for the orign theme creator , and add to the line that it's based on BlackRainV2 or similar.
Also it is as Smoky say that you have portaMX installed there.
For things not working with images and other isses with that, we dont have support on this site for that portal, the theme is not made for PortaMX eather
Why remove my Copyright ?
i just dont know Crip.. ya know, when someone uses something for free, the least they can do is keep the copywrite and say thanks, but copywrite for sure..
removing it just makes them look bad when smarter people know the person that worked hard even to think of making a theme...
sometimes respect is often ignored this way and if you like free stuff.. lol then keep the copywrite..
otherwise ask/pay for the right to remove, :knuppel2:
I havent removed any copyright intentionally. What code do i need to add to the index?
Check the original index.template.php
Ive attached the the index.template.php. Could you help me get your copyright on there crip? Also it wouldn't have TP copyright atm cus ive had to use PortAmx, whos copyright also isnt shown for some reason.
thanks in advance...
I see the copyright just fine on the sites.
Looked at the wrong site.
Hi all, I have a site that I run SMF Gallery Lite and I love this block snippet and I have another site where I am trying out SMF Media Gallery as it has a few more features I like and I was wondering if anyone has or knows how to modify this block code so that it will work for SMG. Thanks heaps in advance. You guys rule!
You will have to ask Dragooon that question, this code is developed by Thurnok and he havent been online for ages, but the gallerys are so diffrent so best would be to ask dragoon make a new code that do the same thing
Thanks I will try that.
Petee, i splitted your post to it's own topic as it is for SMF Media gallery, hope you dont mind.
http://www.tinyportal.net/index.php/topic,27392.0.html
OK, this is difficult...
Any way to use this block with the script below?
<script type="text/javascript">
/***********************************************
* Conveyor belt slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify the slider's width (in pixels)
var sliderwidth="300px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://"><img src="dynamicbook1.gif" border=1></a>'
leftrightslide[1]='<a href="http://"><img src="dynamicbook2.gif" border=1></a>'
leftrightslide[2]='<a href="http://"><img src="dynamicbook3.gif" border=1></a>'
leftrightslide[3]='<a href="http://"><img src="dynamicbook4.gif" border=1></a>'
leftrightslide[4]='<a href="http://"><img src="dynamicbook5.gif" border=1></a>'
//Specify gap between each image (use HTML):
var imagegap=" "
//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5
////NO NEED TO EDIT BELOW THIS LINE////////////
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0"
onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
<a href="http://dynamicdrive.com">Dynamic Drive</a></font></p>
You may see its action there: http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm
It is already implemented in Coopermine Gallery as "Slider".
I would really appreciate any help....
muchas gracias | thanks al lot , it works !
Quote from: dimdom on December 28, 2008, 03:52:28 PM
OK, this is difficult...
Any way to use this block with the script below?
<script type="text/javascript">
/***********************************************
* Conveyor belt slideshow script- Ã,© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify the slider's width (in pixels)
var sliderwidth="300px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://"><img src="dynamicbook1.gif" border=1></a>'
leftrightslide[1]='<a href="http://"><img src="dynamicbook2.gif" border=1></a>'
leftrightslide[2]='<a href="http://"><img src="dynamicbook3.gif" border=1></a>'
leftrightslide[3]='<a href="http://"><img src="dynamicbook4.gif" border=1></a>'
leftrightslide[4]='<a href="http://"><img src="dynamicbook5.gif" border=1></a>'
//Specify gap between each image (use HTML):
var imagegap=" "
//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5
////NO NEED TO EDIT BELOW THIS LINE////////////
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0"
onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
<a href="http://dynamicdrive.com">Dynamic Drive</a></font></p>
You may see its action there: http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm
It is already implemented in Coopermine Gallery as "Slider".
I would really appreciate any help....
This looks really good, I wish you luck with your request.
thanks for the code. I like it...
Really great code! Can add to more features?
1 - show a thumb or dont show images marked as mature content.
2 - a more simple way to adjust size of the thumbnails.
Thanks
I have a problem with the script on my site http://wcsconline.com/index.php following upgrading to smf 1.1.8 originally the block was at the top along the legth of the page but now while not working I have moved it to the bottom of the page. as you can see it is not full width.
Ive added the script below which is unchanged apart from visual options (i think)
Any help greatlyu appreciated.
Quote////////////////////////////////////////////////////
// SMF Gallery Random Picture - ver. 1.8 //
////////////////////////////////////////////////////
//
// Developed by Thurnok
// Thurnok -AT- tinyportal .DOT. net
// November 30, 2006
//
// Updated 9/26/2008
// 1.8
// - added display # of comments option
//
// Used in a TinyPortal phpblock or Article.
// This block displays random/most/least/newest/oldest picture(s) from
// the SMF Gallery mod along with other information
//
//////////////////////////////////////////////
global $scripturl, $db_prefix, $modSettings, $boardurl, $ID_MEMBER, $user_info, $context;
/*
****************************************
****************************************
*** !! Admin Config Section !! ***
****************************************
****************************************
*/
// ***** LAYOUT OPTIONS *****
// how many pictures do you want to show? 0 = all!
$gal_numpics = 9;
// use random, or most recent pics?
// 0 = random, 1 = most recent, 2 = most viewed, 3 = most commented
$gal_showtype = 0;
// sort :: 0 = Descending, 1 = Ascending
$gal_sort = 0;
// enable profile pics display?
// 0 = disable, 1 = enable --- if enabled, and you are viewing a member profile, show pics from that member only
// other options still apply (showtype, sort order, etc)
$gal_profile = 1;
// only show pics from buddies?
// 0 = disable, 1 = enable --- if enabled, will only show pics posted by members in your buddy list
$gal_buddies = 0;
// 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 = 9;
// information display flags (0 = No, 1 = Yes)
// display picture title?
$gal_dispTitle = 0;
// display membername who posted pic?
$gal_dispMember = 0;
// display posted date?
$gal_dispDate = 0;
// 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;
// display # comments
$gal_dispNumComments = 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 = "";
// select only from the following cats - leave empty for all - NOTE:($gal_disallowCats overrides)
// example: $gal_allowCats = "1,3,4" - show only categories 1, 3, and 4
$gal_allowCats = "";
// Require the user has allowedTo('smfgallery_view') permission to view random pics thumbnails in block?
$gal_viewPermission = 1;
/*
****************************************
****************************************
*** !! 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";
// get this user's buddy list
$gal_buddylist = implode(",", $user_info['buddies']);
// prep for our switch routine
if (empty($gal_showtype))
$gal_showtype = 0;
// sort text
if (empty($gal_sort)){
$gal_sort_text = 'DESC';
} else {
$gal_sort_text = '';
}
// are we viewing a member profile and $gal_profile is enabled?
if (!empty($gal_profile) && strtolower($context['current_action']) == "profile"){
$gal_member = empty($_GET['u']) ? $ID_MEMBER : $_GET['u'];
}
// 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,
commenttotal,
ID_CAT
FROM '.$db_prefix.'gallery_pic
WHERE approved = 1
'.(empty($gal_member) ? (empty($gal_buddies) ? "" : (empty($gal_buddylist) ? "AND ID_MEMBER = NULL " : "AND ID_MEMBER in ($gal_buddylist)")) : "AND ID_MEMBER = $gal_member" ).'
'.(empty($gal_disallowCats) ? "" : " AND ID_CAT NOT IN ($gal_disallowCats)").'
'.(empty($gal_allowCats) ? "" : " AND ID_CAT IN ($gal_allowCats)").'
GROUP BY thumbfilename ';
switch ($gal_showtype){
// most/least recent
case 1:
$gal_query .= '
ORDER BY date '.$gal_sort_text;
break;
// most/least viewed
case 2:
$gal_query .= '
ORDER BY views '.$gal_sort_text;
break;
// most/least commented
case 3:
$gal_query .= '
ORDER BY commenttotal '.$gal_sort_text;
break;
default:
$gal_query .= '
ORDER BY rand() '.$gal_sort_text;
break;
}
$gal_query .= (empty($_GET['gal_viewall']) && !empty($gal_numpics)) ? ' 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.'">
</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'])."
\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>
'."\n";
// display poster's name and posted date if enabled
if (!empty($gal_dispMember) || !empty($gal_dispDate)){
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 "
\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 '
in
<a href="'.$scripturl.'?action=gallery;cat='.$row['ID_CAT'].'">'.$gal_tmp['title']."</a>
\n";
}
// display number of views if enabled
if (!empty($gal_dispViews)){
echo "Viewed ".$row['views']." times
\n";
}
// display dimensions if enabled
if (!empty($gal_dispDimensions)){
echo $row['width']."w X ".$row['height']."h
\n";
}
// display filesize if enabled
if (!empty($gal_dispSize)){
echo $row['filesize']." bytes
\n";
}
// display description if enabled
if (!empty($gal_dispDescription)){
echo "
".$row['description']."
\n";
}
// display # of comments if enabled
if (!empty($gal_dispNumComments)){
echo '
<a href="'.$scripturl.'?action=gallery;sa=view;pic='.$row['ID_PICTURE'].'">'.$row['commenttotal']."</a> comment(s)
\n";
}
echo " </td>\n";
$gal_colcnt++;
}
mysql_free_result($gal_result);
echo " </tr>\n</table>\n";
if (!empty($gal_member) && empty($_GET['gal_viewall']))
echo '
<a href="'.$boardurl.'/index.php?action=profile;u='.$gal_member.';gal_viewall=1">View all pics from this member</a>';
if (!empty($gal_buddies) && empty($_GET['gal_viewall'])){
// build the link
$gal_querystring = $context['TPortal']['querystring'];
$gal_querystring .= empty($gal_querystring) ? 'gal_viewall=1' : ';gal_viewall=1';
echo '
<a href="'.$boardurl.'/index.php?'.$gal_querystring.'">View all pics of buddies</a>';
}
}
} else {
echo 'Sorry, you do not have permission to view pictures!';
}
What are your panel settings for that panel?
thanks ichbin, didnt even know that was there, sorted now :)
/me points at quote in sig. :D
Hi Guys, I have several questions about this one. I've never downloaded a snippet before.
Does it work with SMF Gallery Pro?
For multiple galleries, can you specify which gallery to pull from?
To download it, do you just copy the code and paste it into a php block? Or is there a download somewhere that I'm not seeing? ::)
Thanks!
Sarah
Ehhh, did you even take your time reading the first post, or the rest of them ?
1. Yes, will work with SMF gallery pro
2. yes. can have more then one gallery to show ( check the settings in the code )
So, read the first post as all the info you need is right there....
I did read many of the posts, but obviously not carefully enough. So you're right, most of what I needed was right there. Sorry, and thanks for the reply.
Say, where can I get that smiley package?
What smiley package?
The one here - it's way cool. I tried right-clicking and uploading to a folder and importing, but can't seem to get it to work. So I'm hoping it's a downloadable package somewhere. *hopeful smile*
On the SMF website, the mod this works with has been updated.
Does this TP Block still work correctly with the updated SMF Gallery?
This is the latest update of the Mod...
SMF Gallery
Last Modified: May 20, 2009, 09:24:51 PM
Latest Version: 2.0.5
... and as of this reply, this is the last time this TP Block has been updated...
Ã,« Last Edit: September 26, 2008, 22:17 by Thurnok Ã,»
@ ∑Ã,£â„“Ã,¢ââ,¬Â Ã,®Ã,¡Ã,¢ Ã,§á»£Ã...³Ã,¡Ã,,‘,
It's hard to say. I don't have the SMF Gallery Mod installed or I might try it. Do you have the Mod installed? If so, why not try it and let us know if it works. If it doesn't work, I guess it's an easy option to delete the block.
ZarPrime
I'm about to install it, but this TP Block was the main reason for the install, that's why I asked.
Yes, this block code seems to still work with the new SMF Gallery 2.0.5
...but, due to another mod I'm trying to get working with it, I need a copy of the older Gallery version. SMF Gallery 1.9.3
If anyone has a copy of the zip package for this older version,
please email it to me. The address is "electricsquid at hotmail dot com"
Thanks.
Well, I don't know about 1.9.3 but apparently 1.8.3 is available here --> http://custom.simplemachines.org/mods/index.php?mod=473
If you are interested in a 1.9.3 version I suggest you ask the Mod author in this topic --> http://www.simplemachines.org/community/index.php?topic=114291.msg732154#msg732154
or check to see if it's available here --> http://www.smfhacks.com/index.php
ZarPrime
Is SMF Gallery the same as SMF Gallery Lite ?
If so, then I have 1.9.4 if you want it. I looked at the Change Log and there was only one entry for that version between 1.9.4 and 1.9.3
Lemme Know...
Quote from: freddy888 on June 15, 2009, 02:15:42 PM
Is SMF Gallery the same as SMF Gallery Lite ?
If so, then I have 1.9.4 if you want it. I looked at the Change Log and there was only one entry for that version between 1.9.4 and 1.9.3
Lemme Know...
Yes, I would like it.
Thanks
Sent :)
Quote from: freddy888 on June 15, 2009, 03:50:39 PM
Here you go Squiddy :)
Thanks a lot Freddy.
That'll keep me busy for the next few hours :P
No problem :up:
any chance for a SMF Media Gallery conversion?
Quote from: fl4pj4ck on July 02, 2009, 07:12:53 AM
any chance for a SMF Media Gallery conversion?
fl4pj4ck,
What do you mean?
ZarPrime
same block, but working with SMF Media Gallery
Quote from: fl4pj4ck on July 03, 2009, 01:24:06 PM
same block, but working with SMF Media Gallery
You would be best asking over at smf media gallery for this request
:edit:
look here (http://smf-media.com/community/index.php?topic=121.0)
Quote from: Lesmondâ„¢ on July 03, 2009, 01:28:53 PM
Quote from: fl4pj4ck on July 03, 2009, 01:24:06 PM
same block, but working with SMF Media Gallery
You would be best asking over at smf media gallery for this request
:edit: look here (http://smf-media.com/community/index.php?topic=121.0)
Nice find Les. :up: :up:
ZarPrime
Am I correct in thinking that I could reuse some of the code that makes up this block, in order to rebuild how the main Gallery acts?
Some of the options this code has, I would like to add directly to the Gallery code.
I know the other block, but this one is superior talking about configuration, etc, that's why I'm asking
I changed the link from (=gallery) to (=mgallery) here, it works ok but not showing up the pictures
seems it's a little too big for me
Exactly what I need!
Hi I have had it reported that when clicking on any of the images displayed it is not bringing up the full image. A page is displayed saying no image selected with something similar to http://wcsconline.com/index.php?action=gallery;sa=view;pic=71 in the address bar.
Can anyone help please
have noticed that within the gallery when you hover over a picture or click the link shows id= whereas the link generated from the block shows pic=
FIXED edited the below to show id= instead of pic=
// 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>
'."\n";
Glorious snippet!
Great help in the comments to assist configuration: was easy for me to display the 5 most recent pics, with minimal text.
Thank you very much!
Is this something that can be converted to smf 2.0? Will it be a pain to do?
Does this code work ?
http://smf-media.com/community/index.php?topic=121.msg7728#msg7728
Quote from: freddy888 on April 10, 2010, 12:20:55 PM
Does this code work ?
http://smf-media.com/community/index.php?topic=121.msg7728#msg7728
Im sure it works for aeva but, im using SMF gallery. Quite frankly i had it with aeva bugs.
Yep, that block was listed under :
SMF Media Community Ã,» SMF Media Gallery Ã,» Hacks and mods Ã,» Random Image Block for TP
Did you try it then ?
Quote from: freddy888 on April 10, 2010, 12:56:40 PM
Yep, that block was listed under :
SMF Media Community Ã,» SMF Media Gallery Ã,» Hacks and mods Ã,» Random Image Block for TP
Did you try it then ?
In the code, it has 'mGallery" which is for aeva, not for smf gallery. It didnt work, maybe it needs cleanup.
AH okay, my apologies.
So then to save me wading through 30 pages of chat have you got some code that worked with SMF 1 ?
Quote from: freddy888 on April 10, 2010, 01:19:52 PM
AH okay, my apologies.
So then to save me wading through 30 pages of chat have you got some code that worked with SMF 1 ?
Thurnok's first post really worked well in all user aspects in 1.1.x. Would be a great choice for update.
.....sorry Freddy but this code is the only one i've used for smf gallery.
Thats okay, what version of Media Gallery do you use ?
Quote from: freddy888 on April 10, 2010, 01:37:52 PM
Thats okay, what version of Media Gallery do you use ?
None...
If you mean SMF Gallery, i use SMF Gallery Pro which is based of the standard SMF Gallery, http://custom.simplemachines.org/mods/index.php?mod=473
Smf Gallery Pro is a paid mod...
Sorry...was getting confused with all the galleries :P
Well I can try working on it for the free version. I can't buy the Pro version as I have no use for it, but if that code worked for the Pro version maybe it will be okay.
Leave it with me, it will take a while.
Quote from: freddy888 on April 10, 2010, 01:53:54 PM
Sorry...was getting confused with all the galleries :P
Well I can try working on it for the free version. I can't buy the Pro version as I have no use for it, but if that code worked for the Pro version maybe it will be okay.
Leave it with me, it will take a while.
Very well..... ;)
I started a new topic here as this thread is currently for SMF 1 mainly it seems. Made sense to branch out.
New topic here... (http://www.tinyportal.net/index.php?topic=32358)