Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Images uploaded via X threads
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #1
Images uploaded via X threads
Hi, I have a fairly image intensive site (I make 3d models to use in the Sims2 and Sims3 PC games and offer them for free download on my site) and so I like to have a lot of pictures in my threads so my users can see what they are getting.

As sims is a real girls game I have mostly female members on my forum - and so the site needs to look pretty and no taking them off the site for new windows as they appear to get lost and confused when that happens...Erf

I use the lightbox plug in at the moment and that works great on MYBB attachments, but I cant work out how to get the number/name out of the x threads attachments.

I had a look at how the lightbox plug in works and it does a preg_replace to find the aid number.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function lightbox2($page)
{
	global $mybb,$db;
	if(THIS_SCRIPT=="showthread.php")
	{
		$result=$db->simple_select("threads","fid","tid='".intval($mybb->input["tid"])."'",array("limit"=>1));
		$thread=$db->fetch_array($result);
		$permissions=forum_permissions($thread["fid"]);
		if(!empty($thread)&&$permissions["candlattachments"]==1)
		{
			$page=str_replace("</head>",'<link rel="stylesheet" type="text/css" href="'.$mybb->settings["bburl"].'/themes/lightbox.css" />
<script type="text/javascript" src="'.$mybb->settings["bburl"].'/jscripts/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="'.$mybb->settings["bburl"].'/jscripts/lightbox/lightbox.js"></script>
</head>',$page);
			$page=preg_replace('/\<a href="attachment.php\?aid=([0-9]+)" target="_blank"\>\<img/Usi','<a href="attachment.php?aid=$1" rel="lightbox[tid'.intval($mybb->input["tid"]).']"><img',$page);
			return $page;
		}
	}
}


So I thought, hmm, maybe I can swap the code from x-threads images into that preg_replace bit (Im a noob Eyes). So I had a look at the image names on my xthreads images and I'm stumped. I'm using RateU's excellent Product Review set up. I have a link like below for the url:

Code:
http://www.leefish.nl/mybb/xthreads_attach.php/30_1273886872_25376ecb/40b97b161bf0f01d571b319ea3f39d05/bag2.gif


and a link like below for the thumb

Code:
http://www.leefish.nl/mybb/xthreads_attach.php/30_1273886872_25376ecb/40b97b161bf0f01d571b319ea3f39d05/bag2.gif/thumb160x120


So I guess I need to get the thumb and replace it with the number in the url, but I dont see how the images are identified like in that light box code. The numbers are consistent - they begin at 1 and go up to 30 (so far), I'm not sure what all the gobbledegook numbers after the first two digits are. I saw in the x threads that there is a magic number field but I don't really get what that is for either. I have tried all kinds of javascript andjQuery scripts, but I either can't get them to work or they look ugly (see above requirement to look pretty).

So, at the end of a very long rambling thread, can anyone help me to get a lightbox effect using x threads attachments?



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-26-2010 01:32 AM by leefish.)
05-26-2010 01:15 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Images uploaded via X threads
You can use rel attribute in Display Format of the picture.

05-26-2010 07:24 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: Images uploaded via X threads
Rateu, you are indeed truly awesome. Thank you.


[Image: leelink.gif]
MYBB1.6 & XThreads
05-26-2010 07:51 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Images uploaded via X threads
Glad you got it working Smile

(05-26-2010 01:15 AM)leefish Wrote:  I'm not sure what all the gobbledegook numbers after the first two digits are.
If you're wondering, some are for optimisation, and some are meant to be random to prevent people from guessing the URL of files.
Arguably unnecessary, but generally shouldn't hurt Tongue

My Blog
05-26-2010 10:24 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #5
RE: Images uploaded via X threads
(05-26-2010 01:15 AM)leefish Wrote:  As sims is a real girls game I have mostly female members on my forum - and so the site needs to look pretty and no taking them off the site for new windows as they appear to get lost and confused when that happens...Erf

Biggrin

(05-26-2010 01:15 AM)leefish Wrote:  So, at the end of a very long rambling thread, can anyone help me to get a lightbox effect using x threads attachments?

As far as I know, lightbox has category feature. So, if you have more than one XThreads thumbnails in one thread, you can use the lightbox category feature for them. It will make a "tiny" images slide show Smile

05-27-2010 08:34 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #6
RE: Images uploaded via X threads
Hi RateU - yes, I got it working - I have made a link in the first post so it shows the main pic in a little slide show. Here is a link to what I made using your tutorial: Guests can view.

http://www.leefish.nl/mybb/forumdisplay.php?fid=30

Also, I put a <br /> in the blank replacement value of the additional picture field as it was showing a 0 in thethread if there was no picture.

I will post my edits in your thread if you think its worth it?


[Image: leelink.gif]
MYBB1.6 & XThreads
05-27-2010 09:04 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #7
RE: Images uploaded via X threads
(05-27-2010 09:04 AM)leefish Wrote:  Hi RateU - yes, I got it working - I have made a link in the first post so it shows the main pic in a little slide show.

Very nice, Lee Smile Mmm.. Please don't misunderstand me... I think you need to "review" your template. You have missed some close tags Biggrin

(05-27-2010 09:04 AM)leefish Wrote:  Also, I put a <br /> in the blank replacement value of the additional picture field as it was showing a 0 in thethread if there was no picture.

That's why I put &nbsp; in the Blank Replacement Value for the additional pictures Smile

(05-27-2010 09:04 AM)leefish Wrote:  I will post my edits in your thread if you think its worth it?

Of course. I believe that is what the XThreads forum for. To share our idea and modification Smile

Oh yes, I have updated it to make it "compatible" with the newest XThreads version.


Thanks, Lee Smile

05-27-2010 09:38 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #8
RE: Images uploaded via X threads
Yes, I was looking at the WS3 code validator thing - I'm not sure why, but it hates all my <br /> tags and says they are wrong. So I was working on the templates and got a shade carried away..... I have fixed it now.

Yay that you have updated the templates! Cool, now I can also download the new version Smile. I will have a lot of trouble carefully going through all my X threads replacing code, so I really appreciate that. The new updates that Zinga posted look great though, and well worth the effort. X threads is a super plug in.


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 05-27-2010 09:46 AM by leefish.)
05-27-2010 09:45 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Images uploaded via X threads
I have been updated all my example there, Lee Smile
Yep, XThreads is a super tools plugin Smile Amazing.

EDIT: Related to your template, I believe the <br /> should be like that. The W3C Validator "hates" it because there are some other tags isn't closed Biggrin

Example (showthread page):

Your header template:

HTML Code
<td class="thead" colspan="6"


Your dropdown menu:

HTML Code
<img src="images/NewFish/thing.gif"
<div id="forumlink__popup" class="popup_menu" style="display: none;"


And many &nbsp
should be &nbsp;

And add alt and title attribute in each image tags. W3C "loves" it Biggrin
template_prefix_forumdisplay_thread:

HTML Code
<a href="forumdisplay.php?fid=30&amp;filtertf_ep_prefix=Prefix 5"


(This post was last modified: 05-27-2010 10:19 AM by RateU.)
05-27-2010 09:53 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #10
RE: Images uploaded via X threads
Looks like it comes up now, but yeah, you still have a few issues here and there, like the following:

HTML Code
1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- end: help_link -->

		</div>
		</td>
		</strong>
	</table>
</html>
<link rel="stylesheet" type="text/css" href="http://www.leefish.nl/mybb/themes/lightbox.css" />
<script type="text/javascript" src="http://www.leefish.nl/mybb/jscripts/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="http://www.leefish.nl/mybb/jscripts/lightbox/lightbox.js"></script>
</head>

<!-- end: header_welcomeblock_guest -->


Also look through your HTML (view -> source) and search for instances of "lightbox" - I think you have more than one lightbox.js around the place, which might cause some confusion.

Hope that helps.


My Blog
05-27-2010 09:57 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: