Advertisement:

Author Topic: Random Image Attachment Banner  (Read 32647 times)

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Random Image Attachment Banner
« on: May 02, 2010, 03:14:21 AM »
Link to Mod

Random Image Attachment Banner


This mod will pull thumbnail attachments to the top of every page on your forum.  By default, it is set to display 6 thumbnails (side by side) in a banner style container. Each thumbnail in the banner is clickable and leads to the post where it was attached.
Some might ask how is this banner mod different from say the Recent Image Attachments function that is found in SIMPLE PORTAL?
The difference is that my banner mod will actually link to the post where the thumbnail is located.  The SimplePortal mod function only links to the attachment and NOT the post. This is no longer true. SP will link to the actual post where the image attachment is found.


This mod works only with SMF 2.0 RC3 (It has not been tested on any other SMF 2.0's)
There are no permission settings in the admin panel.  This mod works right out of the box. 



I had this mod custom made and was given permission from the author to disperse it. I am limited on the support that i can give with this mod.  My programming skills are very limited.  If any coder wants to take this mod over and expand on it's possibilities, just let me know.  ;D


DEMO DEMO no longer avail
SEE SCREEN SHOT BELOW



Screenshot:






« Last Edit: August 18, 2011, 09:32:03 PM by madman71 »

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #1 on: May 02, 2010, 12:24:29 PM »
IF anyone has any problems installing this mod, Plz let me know  ;D

Should be an easy install

Offline diontoradan

  • Semi-Newbie
  • *
  • Posts: 73
Re: Random Image Attachment Banner
« Reply #2 on: May 19, 2010, 11:28:26 AM »
nice mod, i wish you could have arrangements settings, newest attachment, random, by category, and select display from certain boards...

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #3 on: May 23, 2010, 02:08:18 PM »
super.

But better is the pics are showing with a small size. Any idea what is todo?

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #4 on: May 23, 2010, 06:15:34 PM »
what do you mean "todo"?

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #5 on: May 24, 2010, 04:37:42 AM »
what do you mean "todo"?


on which place I put what so that the pics are - for example - have a width from 300x

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #6 on: May 24, 2010, 12:55:52 PM »
You want to have the thumbnails displayed at 300px wide in the banner??
or do you want the entire banner displayed at 300px wide?

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #7 on: May 25, 2010, 09:14:41 AM »
You want to have the thumbnails displayed at 300px wide in the banner??
or do you want the entire banner displayed at 300px wide?

not the banner, the pics! With the pics like 1024x the style is not nice

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #8 on: May 25, 2010, 10:44:00 AM »
I looked at the code in the BOARDATTACHMENTS.PHP and could not find any place where you can change the dimensions of the displayed thumbnails.

I'll post the code here.  Maybe someone with an eye for code and spot it for you:


I was looking at this part, but i think it has to do with the actual file size and not dimensions.
Code: [Select]
'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'],
BOARDATTACHMENTS.PHP

Code: [Select]
function get_recent_attachments()
{
global $smcFunc, $context, $modSettings, $scripturl, $txt, $settings;

$num_attachments = 6;
$attachment_ext = array('jpg', 'jpeg', 'png', 'gif', 'bmp');

$attachments_boards = boardsAllowedTo('view_attachments');

if (empty($attachments_boards))
return;

if (!is_array($attachment_ext))
$attachment_ext = array($attachment_ext);

$request = $smcFunc['db_query']('', '
SELECT
att.id_attach, att.id_msg, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.id_member,
IFNULL(mem.real_name, m.poster_name) AS poster_name, m.id_topic, m.subject, t.id_board, m.poster_time,
att.width, att.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ', IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
FROM {db_prefix}attachments AS att
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = att.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = att.id_thumb)') . '
WHERE att.attachment_type = 0' . ($attachments_boards === array(0) ? '' : '
AND m.id_board IN ({array_int:boards_can_see})') . (!empty($attachment_ext) ? '
AND att.fileext IN ({array_string:attachment_ext})' : '') .
(!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}
AND att.approved = {int:is_approved}') . '
ORDER BY RAND()
LIMIT {int:num_attachments}',
array(
'boards_can_see' => $attachments_boards,
'attachment_ext' => $attachment_ext,
'num_attachments' => $num_attachments,
'is_approved' => 1,
)
);

$context['recent_attachments'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$filename = preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', htmlspecialchars($row['filename']));

$context['recent_attachments'][$row['id_attach']] = array(
'member' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>',
),
'file' => array(
'filename' => $filename,
'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'],
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'],
'link' => '<img src="' . $settings['images_url'] . '/icons/clip.gif" alt="" /> <a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $filename . '</a>',
'is_image' => !empty($row['width']) && !empty($row['height']) && !empty($modSettings['attachmentShowImages']),
),
'topic' => array(
'id' => $row['id_topic'],
'subject' => $row['subject'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>',
'time' => timeformat($row['poster_time']),
),
);

if ($context['recent_attachments'][$row['id_attach']]['file']['is_image'])
{
$id_thumb = empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'];
$context['recent_attachments'][$row['id_attach']]['file']['image'] = array(
'id' => $id_thumb,
'width' => $row['width'],
'height' => $row['height'],
'img' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . ';image" alt="' . $filename . '" />',
'thumb' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" />',
'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image',
'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . ';image"><img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" /></a>',
);
}
}
$smcFunc['db_free_result']($request);

if (!empty($context['recent_attachments']))
{
loadTemplate('BoardAttachments', 'board_attach');
$context['template_layers'][] = 'board_attach';

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #9 on: June 04, 2010, 10:30:45 AM »
nobody can help?

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #10 on: June 04, 2010, 10:35:15 AM »
You want to have the thumbnails displayed at 300px wide in the banner??
or do you want the entire banner displayed at 300px wide?

not the banner, the pics! With the pics like 1024x the style is not nice

Looking again and your question, it looks like you want large pictures? You want several large images to be displaying IN the banner?

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #11 on: June 04, 2010, 10:47:05 AM »
no,

now the random pics have the original size from the topic (see my attach) and this is to big! this looks not nice. So my idea is to change the size from the pics ..

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #12 on: June 04, 2010, 10:50:09 AM »
could you send me a link to your forum where that picture is?

either here or via PM

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #13 on: June 04, 2010, 10:58:22 AM »
you must know the mod is just install in my test forum http://blog.afrikafrika.de/

user: chef
password: substitute


Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #14 on: June 04, 2010, 11:03:43 AM »
send me a link to this post so i can see the thumbnail in your attachment.

also, where is the banner?

Offline ProfDrDenis

  • Jr. Member
  • **
  • Posts: 120
    • AfrikAfrika Forum
Re: Random Image Attachment Banner
« Reply #15 on: June 05, 2010, 06:43:32 AM »
also, where is the banner?

You dont see? look in the bottom from the test forum or look to my attach pic. and than you click on the pic and you see the post or? but the pic in the post is 800xXX pixel

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #16 on: June 06, 2010, 06:39:24 PM »
This is all i can see:

http://imagesocket.com/view/Test_FORUM_Index_1275863844605438.jpg


I can login with the popup box, but not at the actual forum itself.

Offline Reefer

  • Semi-Newbie
  • *
  • Posts: 64
Re: Random Image Attachment Banner
« Reply #17 on: June 15, 2010, 10:04:12 AM »
Madman... wonder if you can help...


installed your mod and it works great except there is a slight aberration in the display... check:
EDITTED OUT
The frame underneath the thumbnails is out? any idea what to do?
« Last Edit: June 15, 2010, 12:18:20 PM by Reefer »

Offline madman71

  • Full Member
  • ***
  • Posts: 652
Re: Random Image Attachment Banner
« Reply #18 on: June 15, 2010, 10:34:03 AM »
Reef,

I do not see the banner on your site also.

Offline Reefer

  • Semi-Newbie
  • *
  • Posts: 64
Re: Random Image Attachment Banner
« Reply #19 on: June 15, 2010, 10:55:30 AM »
PM'd you login details. It seems guests don't get to see the Banner??