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

« Next Oldest | Next Newest »

Messages In This Thread
Images uploaded via X threads - leefish - 05-26-2010 01:15 AM
RE: Images uploaded via X threads - RateU - 05-26-2010, 07:24 AM
RE: Images uploaded via X threads - RateU - 05-27-2010, 08:34 AM
RE: Images uploaded via X threads - RateU - 05-27-2010, 09:38 AM
RE: Images uploaded via X threads - RateU - 05-27-2010, 09:53 AM

 Standard Tools
Forum Jump: