thumbails in similar threads
duhol Offline
Junior Member
**
Posts: 34
Joined: Mar 2011
Post: #1
thumbails in similar threads
Hey, is it difficult to make thumbails in similiar threads in xthreads gallery forum?
THX
05-25-2011 11:34 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: thumbails in similar threads
Try this:

showthread.php

Find:

PHP Code:
if($mybb->settings['showsimilarthreads'] != 0)
{


Add this code after the code above:

PHP Code:
if($thread['fid'] == X){
	$addfields = ', atf.updatetime, atf.md5hash, atf.uploadtime, atf.aid, atf.attachname, atf.filename, atf.thumbs';
	$addfieldsjoin = ' LEFT JOIN '.TABLE_PREFIX.'xtattachments atf ON (atf.tid=t.tid)';
}

Replace the X with your images gallery forum id.

Find:

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
	SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
	WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
	ORDER BY t.lastpost DESC
	LIMIT 0, {$mybb->settings['similarlimit']}
");


Replace it with:

PHP Code:
1
2
3
4
5
6
7
8
9
$query = $db->query("
	SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance{$addfields}
	FROM ".TABLE_PREFIX."threads t
	LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
	LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$addfieldsjoin}
	WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'
	ORDER BY t.lastpost DESC
	LIMIT 0, {$mybb->settings['similarlimit']}
");


Find:

PHP Code:
eval("\$similarthreadbits .= \"".$templates->get("showthread_similarthreads_bit")."\";");


Add this code before the code above:

PHP Code:
if($thread['fid'] == X){
	$xtimgsimilar_thread = '<img src="'.xthreads_get_xta_url($similar_thread).'/thumb160x120" alt="'.$similar_thread['subject'].'" />';
}

Replace X with your Images Gallery forum id, and 160x120 with the thumbnail size.

For displaying the thumbnail in your similar thread box, put this code in your showthread_similarthreads_bit template:

Code:
{$xtimgsimilar_thread}


05-26-2011 02:23 AM
Find all posts by this user Quote this message in a reply
duhol Offline
Junior Member
**
Posts: 34
Joined: Mar 2011
Post: #3
RE: thumbails in similar threads
What can I say. Works!! Thanks!!
05-27-2011 04:22 AM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #4
RE: thumbails in similar threads
and if we want to show similar threads in video gallery of Youtube?
05-12-2013 03:08 AM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #5
RE: thumbails in similar threads
if($thread['fid'] == 4){
     $xtimgsimilar_thread = 'http://i3.ytimg.com/vi/'.$GLOBALS['threadfields']['vidid'].'/mqdefault.jpg';
}

this is all I´ve could avanced but it not works because the thumbs is about the firts posts and not of similar threads, How can I fix this?
(This post was last modified: 05-12-2013 06:42 AM by Jonatthu.)
05-12-2013 06:28 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: thumbails in similar threads
Instead of RateU's first replacement above, use this one instead:

PHP Code:
if($thread['fid'] == X){
	$addfields = ', tfd.ytvgalid';
	$addfieldsjoin = ' LEFT JOIN '.TABLE_PREFIX.'threadfields_data tfd ON (tfd.tid=t.tid)';
}


Then for the last one:

PHP Code:
if($thread['fid'] == X && $similar_thread['ytvgalid']){
	xthreads_sanitize_disp($similar_thread['ytvgalid'], $threadfield_cache['ytvgalid']);
	$xtimgsimilar_thread = '<img src="http://img.youtube.com/vi/'.$similar_thread['ytvgalid'].'/default.jpg" alt="'.$similar_thread['subject'].'" />';
}


I'm too lazy to bother testing in my current state, so hope that helps.


My Blog
(This post was last modified: 05-24-2013 09:19 AM by ZiNgA BuRgA.)
05-12-2013 11:01 AM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #7
RE: thumbails in similar threads
It was close Biggrin thanks a lot but...

I did that and happened this.

if($thread['fid'] == 4){
     $xtimgsimilar_thread = 'http://img.youtube.com/vi/'.$similar_thread['vidid'].'/mqdefault.jpg';
}

URL= http://img.youtube.com/vi/http://www.you...http://img.youtube.com/vi/http://www.youtube.com/watch?v=uuZE_IRwLNI/mqd

Just the url is wrong I need only the ID of the video Ouch "uuZE_IRwLNI"
05-13-2013 07:15 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #8
RE: thumbails in similar threads
That's not how the Youtube gallery is set up.
Make sure you've set it up properly as described in RateU's thread.

My Blog
05-13-2013 09:36 AM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #9
RE: thumbails in similar threads
íts the same zinga vidid is just a key
i think its something like the text mask i dont know
(This post was last modified: 05-14-2013 08:43 AM by Jonatthu.)
05-14-2013 07:46 AM
Find all posts by this user Quote this message in a reply
Jonatthu Offline
Junior Member
**
Posts: 34
Joined: Mar 2013
Post: #10
RE: thumbails in similar threads
It is missing something, the text mask of the video (?) I don´t really know

if($thread['fid'] == 4){
$addfields = ', tfd.vidid';
$addfieldsjoin = ' LEFT JOIN '.TABLE_PREFIX.'threadfields_data tfd ON (tfd.tid=t.tid)';
}


if($thread['fid'] == 4){
     $xtimgsimilar_thread = 'http://img.youtube.com/vi/'.$similar_thread['vidid'].'/mqdefault.jpg';
}

URL= http://img.youtube.com/vi/ http://www.youtube.com /watch?v=EXZVCfmF_Zw/mqdefault.jpg


When I put {$threadfields['vidid']} the URL is fine just appear the ID of the video not the entire URL
(This post was last modified: 05-18-2013 11:08 AM by Jonatthu.)
05-18-2013 08:23 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: