MyBB Community Forums

Full Version: Thumbnail of attachment in threadlist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
hi all
can any body provide the modification for thumbnail of attachment in threadlist in forum as seen in attachement.
thx for looking my request
if ny body knows plz help............
ny 1?
And what if threads contain multiple attachments ? Threadlist would be messed up i suppose
only the first attachment is to be displayed.......
ny 1 plz
Try this;
Open forumdisplay.php

Find
		else
		{
			$attachment_count = '';
		}

Add Below
		// GET FIRST ATTACHMENT
		$attachment_thumbnail = '';
		if($attachment_count)
		{
			$query = $db->query("
           			SELECT a.thumbnail
            		FROM ".TABLE_PREFIX."attachments a
				LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=a.pid)
            		WHERE p.tid='{$thread['tid']}' AND a.filetype LIKE '%image%'
           		 	ORDER BY a.dateuploaded ASC
				LIMIT 0,1
        		");
			$thumbnail = $db->fetch_field($query, 'thumbnail');
			if($thumbnail)
			{
				$attachment_thumbnail = "<div style=\"float:left\"><img src=\"./uploads/{$thumbnail}\" /></div>";
			}
		}

Then open forumdisplay_thread template

Find
		{$attachment_count}		
                                            <div> 

Add after
		{$attachment_thumbnail}
thx 4 ur reply
IT WORKZ GR8
thankz again
Big Grin
bump...
wow nice Smile
Niceee.
This works really well on the image galleries on my nature photography forum... is there a way to make the resulting thumbnail a clickable link to the thread, just like the thread title?

Thanks!

(2011-04-24, 08:38 PM)Johnasc Wrote: [ -> ]This works really well on the image galleries on my nature photography forum... is there a way to make the resulting thumbnail a clickable link to the thread, just like the thread title?

Thanks!

Replace {$attachment_thumbnail} with the following;
<a href="{$thread['threadlink']}">{$attachment_thumbnail}</a>
Pages: 1 2 3 4 5 6 7 8