Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Bugo on January 19, 2011, 10:19:22 PM

Title: Custom View of Attachments
Post by: Bugo on January 19, 2011, 10:19:22 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=2790)

This mod adds two new methods of placing of thumbnails under posts: in line (with names) and in line (w/o names).
Title: Re: Custom View of Attachments
Post by: Spoogs on January 19, 2011, 10:24:15 PM
Nice  8)
Title: Re: Custom View of Attachments
Post by: lala1 on January 23, 2011, 04:03:57 AM
great mod! thank you!

there is one little problem with the attachment positioning, see image
Title: Re: Custom View of Attachments
Post by: Bugo on January 23, 2011, 04:59:50 AM
Try updated version.
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 06:10:01 AM
Yesterday i see where this mod could work on 1.1.x ,, now i come to download and install it i see only 2.0 supported  :-\ can you please provide the edits for manual install on 1.1.13 please ...
Title: Re: Custom View of Attachments
Post by: Bugo on February 12, 2011, 06:40:38 AM
Sorry, I don't want to support SMF 1.1.x anymore. But you can update your forum to SMF 2.0 RC5 ;)
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 06:54:02 AM
Quote from: Bugo on February 12, 2011, 06:40:38 AM
Sorry, I don't want to support SMF 1.1.x anymore. But you can update your forum to SMF 2.0 RC5 ;)

Trust mi,... That is not an option right now or any time soon

All i need is the edits to install it .. it could be installed on 1.1.x up  to yesterday, i am sorry i never saved the edits in a notepad file or something ..

Please assist, i really need this installed on my 1.1.x forum ASAP

Could you perhaps send me that version [Although i downloaded it yesterday, just never had the time to install it] with instructions via pm .. or leave it on the mod site and mark as outdated..
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 10:17:31 AM
I managed to get it installed as i had downloaded the version for 1.1.x .. how do i get a space between the images like you have it in the example ?? My images are touching..
Title: Re: Custom View of Attachments
Post by: Bugo on February 12, 2011, 10:28:54 AM
Have you seen settings of this mod? Screenshot from SMF 2, although...
You can change a space between the images manually, with option "padding" (see CSS rules).
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 10:32:32 AM
Quote from: Bugo on February 12, 2011, 10:28:54 AM
Have you seen settings of this mod? Screenshot from SMF 2, although...
You can change a space between the images manually, with option "padding" (see CSS rules).

in which css file do i add that rule ? and how ?
Title: Re: Custom View of Attachments
Post by: Bugo on February 12, 2011, 10:35:28 AM
I think you have to read info about Firebug (http://getfirebug.com/?link=4)... at first.
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 10:44:18 AM
Quote from: Bugo on February 12, 2011, 10:35:28 AM
I think you have to read info about Firebug (http://getfirebug.com/?link=4)... at first.

Ok, it pointed me to style.css in my theme .. where do i add the padding to put the space between the images ?
Title: Re: Custom View of Attachments
Post by: Bugo on February 12, 2011, 11:23:02 AM
Use Firebug...
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 11:26:55 AM
Quote from: Bugo on February 12, 2011, 11:23:02 AM
Use Firebug...

:( FireBug confusing me ... not really showing me how to do it
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 11:33:20 AM
Can i not add a hmtl space code [ ] or a padding somewhere in the code below ???

// Custom View of Attachments
if (!empty($modSettings['custom_view_attachments'])) {
if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb']) {
// Begin
echo '', ($modSettings['custom_view_attachments'] != 0) ? '<div style="float: left; min-height: ' . ($modSettings['attachmentThumbHeight'] - 10) . 'px; padding-top: 0.1em">' : '';

// Highslide Image Viewer Installed?
if (function_exists('highslide_images'))
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" class="highslide" rel="highslide"><img src="', $attachment['thumbnail']['href'], '" alt="', $attachment['name'], '" id="thumb_', $attachment['id'], '"', ($modSettings['custom_view_attachments'] != 0) ? ' title="' . $attachment['size'] . ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' (' . $txt['custom_view_attachments_views'] . $attachment['downloads'] . ')' . '"' : '',' border="0" /></a><br /><div class="highslide-heading">', $context['subject'], '</div>';
// Simple Mode
else
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="' , ($context['user']['is_logged']) ? $attachment['thumbnail']['javascript'] : "alert('" . $txt['logintoviewimg'] . "'); return false;" , '"><img src="', $attachment['thumbnail']['href'], '" alt="', $attachment['name'], '" id="thumb_', $attachment['id'], '"', ($modSettings['custom_view_attachments'] != 0) ? ' title="'. $attachment['size']. ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' (' . $txt['custom_view_attachments_views'] . $attachment['downloads'] . ')' . '"' : '',' border="0" /></a>&nbsp;<br />';

}
else
echo '
<div style="float: left; padding-top: 0.1em"><img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';

if ($modSettings['custom_view_attachments'] != 2)
echo '
<img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;<a href="' . $attachment['href'] . '" title="' . $attachment['title'] . '">' . $attachment['name'] . '</a> ';
}
else
echo '
<div style="clear: both"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;<a href="' . $attachment['href'] . '" ' , ($context['user']['is_logged']) ? '' : 'onclick="alert(' . "'" . $txt['login2download'] . "'); return false; " . '"' , '>' . $attachment['name'] . '</a> ';

if ($attachment['is_image'] && ($modSettings['custom_view_attachments'] != 0))
echo '&nbsp;</div>';
else
echo '(' . $attachment['size'] . ' ~ ' . (!$attachment['is_image'] ? $txt['custom_view_attachments_downloads'] : $txt['custom_view_attachments_views']) . $attachment['downloads'] . ')</div>';
}
else {

{

if ($attachment['thumbnail']['has_thumb'])

echo '

<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" class="highslide" rel="highslide"><img src="', $attachment['thumbnail']['href'], '" alt="' , $attachment['name'] , '" id="thumb_', $attachment['id'], '" border="0" /></a><br /><div class="highslide-heading">' , $context['subject'] , '</div>';

else

echo '

<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';

}

echo '

<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> (' . $attachment['size'] . ' ~ ' . (!$attachment['is_image'] ? $txt['custom_view_attachments_downloads'] : $txt['custom_view_attachments_views']) . $attachment['downloads'] . ')<br />';} // Happy End ~ Custom View of Attachments

}



echo '

</div>';

}



echo '

</td>

</tr><tr>

<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 12:52:29 PM
OK, this line seems to control what i want to edit ..

echo '', ($modSettings['custom_view_attachments'] != 0) ? '<div style="float: left; min-height: ' . ($modSettings['attachmentThumbHeight'] - 10) . 'px; padding-top: 0.5em">' : '';

When i add a right padding i can no longer adjust the top padding ... please advise..

My code looks like this

echo '', ($modSettings['custom_view_attachments'] != 0) ? '<div style="float: left; min-height: ' . ($modSettings['attachmentThumbHeight'] - 10) . 'px; padding-top: 0.5em' . 'px; padding-right: 1.5em">' : '';
Title: Re: Custom View of Attachments
Post by: Bugo on February 12, 2011, 01:10:57 PM
Quote from: Bugo on February 12, 2011, 06:40:38 AM
Sorry, I don't want to support SMF 1.1.x anymore. But you can update your forum to SMF 2.0 RC5 ;)
Title: Re: Custom View of Attachments
Post by: aw06 on February 12, 2011, 01:17:45 PM
This is really a shame .. if i had only come for supprt a few days earlier .. tsk tsk
Title: Re: Custom View of Attachments
Post by: lala1 on February 15, 2011, 04:46:05 AM
Quote from: Bugo on January 23, 2011, 04:59:50 AM
Try updated version.

Tried. Something changed for sure. Can you crop a part of the thumbnail in order to make them all same size? It should display it better then.

Thanks,
lala
Title: Re: Custom View of Attachments
Post by: Bugo on February 15, 2011, 04:57:15 AM
You can use Resize Attached Images (http://custom.simplemachines.org/mods/index.php?mod=2206) for it.
Title: Re: Custom View of Attachments
Post by: aw06 on February 15, 2011, 09:02:27 AM
Quote from: lala1 on February 15, 2011, 04:46:05 AM
Quote from: Bugo on January 23, 2011, 04:59:50 AM
Try updated version.

Tried. Something changed for sure. Can you crop a part of the thumbnail in order to make them all same size? It should display it better then.

Thanks,
lala

This is how i did it .. works like a charm
http://www.simplemachines.org/community/index.php?topic=421677.msg2949881#msg2949881
Title: Re: Custom View of Attachments
Post by: 9083ja on December 13, 2011, 10:23:04 PM
Hello,

I install custom view of attachment package for smf 2.0.1, but when i select to view attachments horizontally and apply then i can't see attachments.
When can i do ?

Regards !!
Title: Re: Custom View of Attachments
Post by: Bugo on December 14, 2011, 03:22:50 AM
Did you install New Hooks (http://www.simplemachines.org/community/index.php?topic=454883.msg3184910#msg3184910) package?
Title: Re: Custom View of Attachments
Post by: 9083ja on December 14, 2011, 07:44:36 AM
Quote from: Bugo on December 14, 2011, 03:22:50 AM
Did you install New Hooks (http://www.simplemachines.org/community/index.php?topic=454883.msg3184910#msg3184910) package?

ok, thanks, now i can see attachment horizontally correctly ;-), it can be posible to add a funtion to adjust images horizontally automatically depending on a user resolution ?

thanks and regards !
Title: Re: Custom View of Attachments
Post by: djoos5 on January 04, 2012, 12:52:46 AM
I am needing help with your mod please.

I am running SMF 2.0.2 and I did the following:

- Uploaded the Subs-CustomView.php to my /Sources folder
- Uploaded the CustomView.english.php to my /Themes/default/languages/ folder
- Uploaded the Hooks.php file to my main directory called /boards
- Uploaded the install.xml file to my main directory called /boards
- Uploaded the package-info.xml file to my main directory called /boards

I then ran the Hooks.php and it came up with a white page that says, "Database changes are complete! Please wait..." and nothing else.

I then went to view my boards and all of the attachments have disappeared and the layout is out of whack.

Any suggestions would be a big help.

Thanks
Title: Re: Custom View of Attachments
Post by: Bugo on January 04, 2012, 01:18:28 AM
Quote from: Bugo on December 14, 2011, 03:22:50 AM
Did you install New Hooks (http://www.simplemachines.org/community/index.php?topic=454883.msg3184910#msg3184910) package?
Title: Re: Custom View of Attachments
Post by: djoos5 on January 07, 2012, 11:23:27 AM
Thank you for the reply - and let me start by saying I am not a modder, programmer, or anything. I would say I am a tinkerer with my boards, and I do that with very careful understanding of the instructions that are given in the Mods section.

So, no, I did not install the New_hooks package and the question I have now is where do I install it? In what folder of SMF software? Does it go in the same folder with the Hooks.php file? Does install.xml and package-info.xml need to be in that folder, too?

I appreciate your MOD very much, having used the version prior to your current update, but now the instructions for install are very vague.
Title: Re: Custom View of Attachments
Post by: Bugo on January 07, 2012, 11:36:57 AM
Use Package Manager for install.
Title: Re: Custom View of Attachments
Post by: distante on February 06, 2012, 11:05:59 AM
Hello Bugo! thanks for this mod I found it very useful especially when I used with "highslide 4 smf" and ILA mod's.

But, I have a problem with the compatibility of "Custom..." and ILA(http://custom.simplemachines.org/mods/index.php?mod=2481)

ILA mod adds some attachments to the post in self if the user put the code for this, when the attach is in inside the post, the attach below the post isn't showed.

But when I set "Custom..." in Default, all work fine, but if I set it to display the attachments in horizontal way, all the attachments are showed. Since you are using hooks and I don't really quite now how the hooks works, I can't figure out what to change in order to both mods can coexist.

Can you give me a hand?

Regards!
Title: Re: Custom View of Attachments
Post by: Bugo on February 06, 2012, 11:04:22 PM
Try this file.
Title: Re: Custom View of Attachments
Post by: distante on February 07, 2012, 12:41:28 AM
It Worked Perfect Bugo!!

I will look what you did to try to learn something about the hooks hehe

Thanks a lot!
Title: Re: Custom View of Attachments
Post by: Fearless Freap on February 19, 2012, 02:03:32 PM
Not that it makes much difference to me, I have an issue with your mod and another one.  I have just installed 2.0.2 and it turns out if you have CVA installed and the Thank-o-matic mod installed, the page crashes.  Even with the hooks update in place.  I value your mod over the other so I uninstalled Thank-o-Matic.  I don't understand why this isn't a standard option in SMF (no offense to you and your mod) as an option to condense space.

It might prove frustrating to anyone else who might have it already in place.  The pictures will show up if you leave them as they would show up normally in the forum, but when you try to post them in a line (with or without names) they disappear.

Again, I love the mod.  Thanks!
Title: Re: Custom View of Attachments
Post by: Iomega0318 on May 13, 2012, 09:08:29 PM
Is there a way to have this mod only work on images and not other uploads?
I would love for it to show images like how it is on the link below at the top with all other downloads listed normally beneath the images.. sort of how this mod works:
http://custom.simplemachines.org/mods/index.php?mod=771

Other than that it works great! You can see a good example here with 40 images!
http://www.uofreeshards.net/index.php?topic=195.0
Title: Re: Custom View of Attachments
Post by: pols1337 on June 02, 2012, 01:13:34 PM
Help!  I'm getting a double view of my custom view of attachments.  How do I fix this?
Title: Re: Custom View of Attachments
Post by: Arvacon on December 24, 2012, 03:17:57 PM
Quote from: Fearless Freap on February 19, 2012, 02:03:32 PM
Not that it makes much difference to me, I have an issue with your mod and another one.  I have just installed 2.0.2 and it turns out if you have CVA installed and the Thank-o-matic mod installed, the page crashes.  Even with the hooks update in place.  I value your mod over the other so I uninstalled Thank-o-Matic.  I don't understand why this isn't a standard option in SMF (no offense to you and your mod) as an option to condense space.

It might prove frustrating to anyone else who might have it already in place.  The pictures will show up if you leave them as they would show up normally in the forum, but when you try to post them in a line (with or without names) they disappear.

Again, I love the mod.  Thanks!

I have the same issue here.
I did the same thing, I uninstalled thank-o-matic and now I don't get the below error anymore.

Parse error: syntax error, unexpected 'elseif' (T_ELSEIF) in H:\wamp\www\********\Themes\default\Display.template.php on line 544

But it must be a solution for these two to work together, isn't it?

I found that at line 544 there was this code before:

elseif (($message['thank_you_post']['post'] && !$message['thank_you_post']['locked']) || (($message['thank_you_post']['lock'] || $message['thank_you_post']['delete']) && $message['thank_you_post']['isThankYouPost']))

but after I uninstalled the thank-o-matic, now it is this one at the same line:

// ILA in line attachment changes

if (!isset($context['ila_dont_show_attach_below']) || !array_key_exists($attachment['id'], $context['ila_dont_show_attach_below']))
{

// End ILA in line attachment changes


I hope these info to help you find a solution, as I am not a programmer..
Title: Re: Custom View of Attachments
Post by: Mick. on December 24, 2012, 03:58:00 PM
Oooooo I dig this mod! Thanx!
Title: Re: Custom View of Attachments
Post by: Arvacon on December 25, 2012, 05:19:01 PM
Is there any way to make this mod align automatically the attached images in line, when you view them in different screen resolution?
For example when I have a screen with 1024x768 I see 3 pics in line and then another 3 under them but when I change the resolution at 1280x1024 you see the pics also 3 in line and with big spaces between them, so if you upload 20 pictures, they will be in 7 lines vertically..

I will upload 2 pics with what I mean, to clarify the things.
Title: Re: Custom View of Attachments
Post by: Arvacon on January 03, 2013, 06:46:39 PM
Hi guys, happy new year to everyone.
I know that the above problem must not be so difficult to solve, but I have searched everywhere and can't find a real solution.
Pictures will be an important part for my forum, as the members need to introduce their structures, so imagine if someone needs upload more than 20 pics in a row, his post will be almost 1 page long because of the way that the pictures not going in line as they should  be..

If someone has any solution, or if this has been written somewhere else, please let me know with a link, about where is a solution already given, to solve this problem by reading this.

I hope somebody can help solve this problem soon, as this is a real issue for my forum.  :-[
Title: Re: Custom View of Attachments
Post by: Bugo on January 03, 2013, 11:19:23 PM
There is option "Max attachments per line" in mod's settings. Doesn't it help you?
Title: Re: Custom View of Attachments
Post by: Arvacon on January 03, 2013, 11:40:09 PM
Hi Bugo, thanks for your reply.
Actually that doesn't help, as if the pictures are a lot, you will can see them only if you move the bar under them, even if you use big resolution as at the below pictures, so the user feels tired to always have to move the bar to see them. Imagine if you have 20 or 30 pictures there, that will be annoying.
Is there any code that I can put at your mod to make them fit to every resolution without the need of bar, so to be visible as grid?
Title: Re: Custom View of Attachments
Post by: Bugo on January 04, 2013, 04:10:19 AM
Do you want only the small spaces between attachments? Just open Subs-CustomView.php, find
<table width="90%">
and remove width attribute.
Title: Re: Custom View of Attachments
Post by: Arvacon on January 04, 2013, 05:48:43 AM
Actually I want my attachment pictures to look like at this forum's post http://www.cnchobby.gr/forum/default.aspx?g=posts&m=20208#post20208 (http://www.cnchobby.gr/forum/default.aspx?g=posts&m=20208#post20208) .
Try to zoom-in, zoom-out and you will understand what I mean.
I did the change that you said at the code, but that is not exactly what I need.
If you can't open the above link, tell me to take some screen shots for you.
Title: Re: Custom View of Attachments
Post by: Bugo on January 04, 2013, 06:37:03 AM
Try this file, at your own risk :)
Title: Re: Custom View of Attachments
Post by: Arvacon on January 04, 2013, 07:03:10 AM
Friend I don't know how to thank you!
At my local installation it workes like charm!  :D

Thank you very much  :)
I will test it at my live forum too and if there is any problem, I will inform you.

Grettings from Greece!
Kostas
Title: Re: Custom View of Attachments
Post by: Arvacon on January 04, 2013, 02:36:53 PM
Hi Bugo.
I noticed that when you have 1024x768 resolution, it keeps have an uncompleted space at the right side, when it could be filled with pictures too.
That happens at the other resolutions too, but it seems vividly at the above resolution, as the pictures follow two vertical series instead of 3.
Is there any way to correct this too? 
Title: Re: Custom View of Attachments
Post by: Arvacon on January 04, 2013, 03:18:37 PM
Finally I found a problem  :(
The appearance of the posts doesn't looks correct now. This had happen again when I first installed your mod, but after I installed the new hooks, everything was fine.
What do I need to change to fix this and the above post's problem too?

Title: Re: Custom View of Attachments
Post by: Hristo on January 04, 2013, 05:03:28 PM
Quote from: Arvacon on January 04, 2013, 02:36:53 PM
...when it could be filled with pictures too.
....
Is there any way to correct this too?
No, there is no enough space for another image. I have no access to your forum, but I'm sure this can be fixed with some small css tweaks. Just use your browser's dev tool to check the left and right attached images margin, then apply it in your theme's index.css.

Title: Re: Custom View of Attachments
Post by: Arvacon on January 04, 2013, 07:06:19 PM
I think there is space for another image, it just need to be closer to each other as it happens when you have the default Subs-CustomView.php file and you choose "Max attachments per line" = 3
(as at the bellow photo).

Edit: I forgot to mention that I found also that the text at posts, when it has a lot of letters, it seems as at the photo, with a bar under them too, but I don't know if this is because of this mod or any other mod.
Just in case this is easy to be fixed or this mod cause it, if you have any solution for this too, I would appreciate if you could help about this too.
  Finally this is not an issue of this mod, it is just happening when you have lot of letters in a row, without meaning. When you have words and documents, everything works fine, as they mention here http://www.simplemachines.org/community/index.php?topic=488069.0

Edit2: I found that when I have the new Subs-CustomView.php file installed at my forum, except from the problems at the template's appearance, the quick edit function's save button doesn't respond. If I replace this file with the default one, the template and the quick edit are fine. Maybe these info help u more.
Title: Re: Custom View of Attachments
Post by: Bugo on January 05, 2013, 04:14:47 AM
Test new version, please.
Title: Re: Custom View of Attachments
Post by: Arvacon on January 05, 2013, 06:25:40 AM
I tried it just now and it seems the template problem solved.
Also the pictures now can auto aligned.
I just see a small problem when you have different size pictures at the same post, as it seems at the screen shots bellow. Actually that is not so big problem, but it would be nice if you could correct it too (by the way, if you have same size pictures, everything looks in line as at "same size" photos bellow).
Thank you for your time, I really appreciate it.

Edit: I made some corrections at the picture's names.
Title: Re: Custom View of Attachments
Post by: Calaad on February 28, 2013, 12:08:43 PM
Hello,

I just add this mod to my forum. Last version of forum, last version of mod.

When i select "in the line" with or without filename, attachments just disappear. They're back when i select "In column". I install new hook without any change.

I've custom theme, could it be the source of the problem ?

Thank by advance and for the work done !

Calaad.
Title: Re: Custom View of Attachments
Post by: Bugo on February 28, 2013, 01:12:41 PM
What theme are you using? SMF version?
Title: Re: Custom View of Attachments
Post by: Calaad on March 01, 2013, 03:57:31 AM
Hello,

I'm using an homemade theme, based on curved. My SMF version is 2.0.4.

If it can help, i join a screenshot of my installed extension.
Title: Re: Custom View of Attachments
Post by: Bugo on March 01, 2013, 05:20:14 AM
Try New Hooks 0.3, and select "Install in Other Themes" (homemade) on install.
Title: Re: Custom View of Attachments
Post by: Calaad on March 01, 2013, 05:28:13 AM
It works !

Thanks a lot Bugo ! :)
Title: Re: Custom View of Attachments
Post by: madvex on September 29, 2013, 12:32:27 PM
Quote from: Bugo on March 01, 2013, 05:20:14 AM
Try New Hooks 0.3, and select "Install in Other Themes" (homemade) on install.

In SMF 2.0.5 the New Hooks 0.3 file is a must.

As others reported, I also had the horizontal setting causing all attachments to disappear.  The New Hooks file install rectified those issues.
Some manual tweaks for padding in the CSS it works great!

Excellent mod! Thanks!

PS: The manual CSS tweak I performed for the padding is as follows:
In your current theme CSS folder, edit "index.css" as follows:

Find:
.attachments div {
padding: 0 0.5em;
}


Replace with:
.attachments div {
  padding: 2em 1em;
}


I'd recommend using firebug and play with the settings before making the actual edit so you can see the effects in real-time.
Or, you can comment out the old lines if you want to easily revert.