Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: madman71 on May 02, 2010, 03:14:21 AM

Title: Random Image Attachment Banner
Post by: madman71 on May 02, 2010, 03:14:21 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2523)

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:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg1.uploadhouse.com%2Ffileuploads%2F5324%2F5324631cb50921c7e52c3c7ff63e67c8f5e33c0.jpg&hash=c68098a6cd03748492c7f4991f140ff5d973b20a) (http://www.uploadhouse.com/viewfile.php?id=5324631&showlnk=0)





Title: Re: Random Image Attachment Banner
Post by: madman71 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
Title: Re: Random Image Attachment Banner
Post by: diontoradan 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...
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis 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?
Title: Re: Random Image Attachment Banner
Post by: madman71 on May 23, 2010, 06:15:34 PM
what do you mean "todo"?
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis on May 24, 2010, 04:37:42 AM
Quote from: madman71 on May 23, 2010, 06:15:34 PM
what do you mean "todo"?

on which place I put what so that the pics are - for example - have a width from 300x
Title: Re: Random Image Attachment Banner
Post by: madman71 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?
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis on May 25, 2010, 09:14:41 AM
Quote from: madman71 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?

not the banner, the pics! With the pics like 1024x the style is not nice
Title: Re: Random Image Attachment Banner
Post by: madman71 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.
'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'],

BOARDATTACHMENTS.PHP

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';
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis on June 04, 2010, 10:30:45 AM
nobody can help?
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 04, 2010, 10:35:15 AM
Quote from: ProfDrDenis on May 25, 2010, 09:14:41 AM
Quote from: madman71 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?

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?
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis 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 ..
Title: Re: Random Image Attachment Banner
Post by: madman71 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
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis 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

Title: Re: Random Image Attachment Banner
Post by: madman71 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?
Title: Re: Random Image Attachment Banner
Post by: ProfDrDenis on June 05, 2010, 06:43:32 AM
Quote from: madman71 on June 04, 2010, 11:03:43 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
Title: Re: Random Image Attachment Banner
Post by: madman71 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.
Title: Re: Random Image Attachment Banner
Post by: Reefer 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?
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 10:34:03 AM
Reef,

I do not see the banner on your site also.
Title: Re: Random Image Attachment Banner
Post by: Reefer on June 15, 2010, 10:55:30 AM
PM'd you login details. It seems guests don't get to see the Banner??
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 11:02:58 AM
Ok, there's a couple things we can do in which i think i can assist.
1. We can make the banner wider but it go beyond the width of the forum
2. we can cut down the number of image permitted to be displayed in the banner (down to 5 maybe)
3. Not a fix, but we can change what type (format) of images to be displayed in the banner (i.e. portrait or landscape)


When i used this mod, i removed all landscape images from it (just for aesthetics) and cut down the number of images displayed.  This was for me thought :)

one final, possible solution: I noticed that you are using SimplePortal 2.3.2.  I have have stopped using my own mod and i now use SP random attachment banner.  Basically, it does the same thing as mine does, but has way more functions.

I can probably help you which ever method you take.
Title: Re: Random Image Attachment Banner
Post by: Reefer on June 15, 2010, 11:09:41 AM
Where can I find the Simple Portal one? Lets give it a bash. If it doesn't work, I'm coming after you...Lol!
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 11:17:25 AM
It's in the ADMIN section of SMF

Look under SP settings.

Look at the image here:

If you need assistance setting it up, i can help
Title: Re: Random Image Attachment Banner
Post by: Reefer on June 15, 2010, 11:23:21 AM
Kewl, thanks for your help... I'll give it a bash! ;D
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 11:28:53 AM
NP, there's lots go juicy info here: http://www.simpleportal.net/
Title: Re: Random Image Attachment Banner
Post by: Reefer on June 15, 2010, 11:40:50 AM
OK... tried it but it doesn't link to the original post, right?
I we were to use yours, and limit it to 5 image attachments... how could we go about doing this?
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 11:58:12 AM
it does the same exact thing that mine does, but come to think of it, i think you have to tweak the code to have it link directly to the post.  By default, it does not link directly to the post, only to the image.

To make the images link to the post, follow this
http://simpleportal.net/index.php?topic=4118.0

look for Sinan's post.  very small piece of code to replace
Title: Re: Random Image Attachment Banner
Post by: Reefer on June 15, 2010, 12:16:49 PM
Thanks once again Laurel... you be a champ!
Title: Re: Random Image Attachment Banner
Post by: madman71 on June 15, 2010, 12:24:28 PM
Quote from: Reefer on June 15, 2010, 12:16:49 PM
... you be a champ!

Sinan be the champ ;)
Title: Re: Random Image Attachment Banner
Post by: kikkuvikings on October 01, 2010, 11:22:13 AM
willl it automatically show the latest topics / or i have to add the topics manually (if it is manually done , how can i select that option on smf 2.0RC3)
Title: Re: Random Image Attachment Banner
Post by: madman71 on October 01, 2010, 11:56:48 AM
It will only show recent attachments in a banner format.
Look into simplePortal if you really want to have control (i.e. latest topics)
http://www.simpleportal.net/
Title: Re: Random Image Attachment Banner
Post by: dkharp on November 06, 2010, 10:09:21 PM
Great Mod! Can you set it to wear it does not pull the view board permissions? That way guest can see the pics too?  Also how do you set it to wear it will only show on the board not all the other pages. Im using TP and it shows up the front page..

Powered by SMF 2.0 RC3/TinyPortal 1.0 beta 5.2

Thanks!
Title: Re: Random Image Attachment Banner
Post by: madman71 on November 06, 2010, 10:21:18 PM
Quote from: dkharp on November 06, 2010, 10:09:21 PM
Great Mod! Can you set it to wear it does not pull the view board permissions? That way guest can see the pics too?  Also how do you set it to wear it will only show on the board not all the other pages. Im using TP and it shows up the front page..

Powered by SMF 2.0 RC3/TinyPortal 1.0 beta 5.2

Thanks!

Im not sure what you mean by "does not pull the view board permissions".
This banner will display images to EVERYONE.  Even guests.  Now, if guests do not have permission to view attachments, then the banner thumbs will not be displayed.  ***NOTE** Guest must have permission to view attachments in posts in order for them to see this banner.

Im not the mod creator, i just paid to have this coded up for me.  When i told the programmer what i wanted, I told him that i wanted it to be displayed on all pages. There is no option to place it where you want it.

If you truly want full control over a banner style like mine, uninstall it my mod, and install http://www.simpleportal.net/
I know you are using TP, but SP has banner just like mine with millions of functions to tweak.
Might want to look into that.

if you want to see the SP banner in action, you can view my site: www.morningpeaches.us (This is an adult board with adult images) This banner is not randomized, but it can be set to.
Title: Re: Random Image Attachment Banner
Post by: Ciler on January 09, 2011, 07:01:31 AM
I have it working with the SP Block Recent Image Attachement but the Images are still!

Does somebody knows the code in PortalBlocks.php to make the images scrolling (moving)?


Title: Re: Random Image Attachment Banner
Post by: impreza on January 09, 2011, 03:18:45 PM
Interesting mod, thanks for making
Title: Re: Random Image Attachment Banner
Post by: Biology Forums on March 06, 2011, 07:01:41 PM
Can someone make this work for 1.1.13 :( ?
Title: Re: Random Image Attachment Banner
Post by: Snowy on April 03, 2011, 01:26:26 PM
I love this, but the pictures are too big. I had to make it show only 3 pictures. I want them smaller, like 100 pixels. As it is now, 3 pictures goes the width of the forum. They asre just too big. How do I change the display size?
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 03, 2011, 01:33:23 PM
In your admin section, under ATTACHMENTS & AVATARS, what settings do you have for these:

Maximum width of thumbnails =
Maximum height of thumbnails  =
Title: Re: Random Image Attachment Banner
Post by: Snowy on April 03, 2011, 02:24:16 PM
I had them set at 250, but changed them to 100 and it didn't change the size of the pics.
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 03, 2011, 03:18:39 PM
well, im pretty certain it's a SMF setting and not a mod setting.  When i had it made, i had it made to display thumbnails from post attachments.

I highly recommend installing simple portal.  It has the a random image banner with much more functionality.

Title: Re: Random Image Attachment Banner
Post by: Biology Forums on April 04, 2011, 09:51:26 PM
I really want this for 1.X :-[
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 04, 2011, 10:46:19 PM
1.x will not happen.

Install Simple Portal, and you'll get your random image banner.
Title: Re: Random Image Attachment Banner
Post by: Biology Forums on April 05, 2011, 01:55:25 PM
Quote from: madman71 on April 04, 2011, 10:46:19 PM
1.x will not happen.

Install Simple Portal, and you'll get your random image banner.

Simple portal changes the dynamics of my website, so I'm not going to do that.
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 05, 2011, 02:20:22 PM
The only thing that i can think of that would change your site is that you would have a front entry page (portal) and the image banner anywhere or everywhere on your site. You would have way more banner placement options with SP.

with my banner, you are quite limited
Title: Re: Random Image Attachment Banner
Post by: Biology Forums on April 05, 2011, 02:37:08 PM
Quote from: madman71 on April 05, 2011, 02:20:22 PM
The only thing that i can think of that would change your site is that you would have a front entry page (portal) and the image banner anywhere or everywhere on your site. You would have way more banner placement options with SP.

with my banner, you are quite limited

I like your mod because I want to give users an idea of what people are uploading in threads. Maybe just the latest image upload and not necessarily a scrolls.
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 05, 2011, 02:57:47 PM
That's exactly what the SP image banner does. The SP banner does NOT scroll. it does exactly what mine does.  in fact, the writer of my mod is the writer of SP.

I dont run my mod anymore on my site, i use to the SP banner. There's more options.  If you want to see it in action i can let you view my site.

***it's a fine art adult site***
Title: Re: Random Image Attachment Banner
Post by: Biology Forums on April 06, 2011, 01:39:19 PM
Quote from: madman71 on April 05, 2011, 02:57:47 PM
T***it's a fine art adult site***

LOL, no thank you in that case. But I have seen a website in the past with it installed.
Title: Re: Random Image Attachment Banner
Post by: samozin on April 09, 2011, 11:52:24 AM
can u make it recent attached images from acertian board to be used on portal frontpage?
Title: Re: Random Image Attachment Banner
Post by: madman71 on April 14, 2011, 02:54:54 PM
Quote from: samozin on April 09, 2011, 11:52:24 AM
can u make it recent attached images from acertian board to be used on portal frontpage?



sorry for the delay
with my mod, no. Not without more coding to the mod.  With SimplePortal, it may be possible to select a board to pull from.
Title: Re: Random Image Attachment Banner
Post by: moguns on August 18, 2011, 06:03:36 PM
Are you still around? This is a great mod. Can it be updated
Title: Re: Random Image Attachment Banner
Post by: madman71 on August 18, 2011, 09:28:00 PM
As i have mentioned already, this mod will not be updated (at least by me). it has served its purpose for me.  I have now moved on to using the random image attachment banner that is found in the simple portal modification.

There's so much more control of the attachment banner that is found in simple portal.

http://www.simpleportal.net/
Title: Re: Random Image Attachment Banner
Post by: moguns on August 19, 2011, 03:40:05 AM
I agree but I just use smf as it is intended not as a full site. Less is better with smf.
Title: Re: Random Image Attachment Banner
Post by: NiceCarvings on July 11, 2012, 09:52:24 PM
On the simple portal version it doesn't link to the thread where the image was posted, or does it?
Title: Re: Random Image Attachment Banner
Post by: madman71 on July 11, 2012, 10:32:19 PM
Quote from: NiceCarvings on July 11, 2012, 09:52:24 PM
On the simple portal version it doesn't link to the thread where the image was posted, or does it?

it does:
http://simpleportal.net/index.php?topic=4118.0
Title: Re: Random Image Attachment Banner
Post by: Herrybraun on February 24, 2016, 11:30:20 AM
Thank you so much to post it. I really appreciate it.