Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: GL700Wing on January 10, 2021, 08:59:39 PM

Title: Image Attachment Thumbnail View
Post by: GL700Wing on January 10, 2021, 08:59:39 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=4277)

Image Attachment Thumbnail View - v 1.5

Thumbnail-sized view of images in Administration Center, Member Profiles and Moderation Center.

By default only download links are provided for image attachments accessed via Administration Center >> Attachments and Avatars >> Browse Files and Profile of Member >> Show Posts >> Attachments and only file names are shown for unapproved attachments accessed via Moderation Center >> Unapproved Attachments.

In addition, unapproved attachments listed in the Administration Center are not identified by either the use of a different coloured row background or the addition of the text  '(Awaiting Approval)'  below the filename. (In Member Profiles unapproved attachments have both these attributes).

This mod provides the option to display a thumbnail-sized (ie, max 150px x 150px) view of all image attachments in the Administration Center, Member Profiles and Moderation Center.

In addition, this mod adds download links unapproved attachments in the Moderation Center, uses a different coloured row background for unapproved attachments listed in the Administration Center, and displays the text  '(Awaiting Approval)'  after the filename of unapproved attachments in both the Administration Center and Member Profiles.

Administration Center:
This mod provides the option to display a thumbnail-sized (ie, max 150px x 150px) view of all image attachments (ie, attachments, avatars and thumbnails) above the download link.

The option is enabled/disabled via the 'Display thumbnail-sized view of image attachments in Admin Center' setting in Administration Center >> Attachments and Avatars >> Attachment Settings.


Member Profiles:
This mod provides the option for Admins, Moderators and/or members to see a thumbnail-sized (ie, max 150px x 150px) view of image attachments above the download link.

These options are enabled/disabled via the 'Allow Admins to see a thumbnail-sized view of image attachments in all member profiles', 'Allow Moderators to see a thumbnail-sized view of image attachments in all member profiles' and 'Allow members to see a thumbnail-sized view of image attachments in member profiles' settings in Administration Center >> Attachments and Avatars >> Attachment Settings.


Moderation Center:
In addition to also providing the same option for unapproved attachments for moderators this mod also adds download links for ALL types of unapproved attachments.
(Note: Download links will be displayed even if the thumbnail view is disabled).

The option to display a thumbnail-sized (ie, max 150px x 150px) view of unapproved image attachments is enabled/disabled via the 'Display thumbnail-sized view of unapproved image attachments in Moderation Center' setting in Administration Center >> Attachments and Avatars >> Attachment Settings.


Release History:
1.0 - 26-Dec-20
o Initial Release with support only for SMF 2.0.17

1.1 - 21-Jan-21
o Added support for SMF 2.0.10-2.0.17 and SMF 2.1 RC3

1.2 - 06-Feb-21
o Added support for SMF 2.0.18

1.3 - 07-Feb-21
o SMF 2.0.xx - Fixed two bugs in GenericList.template.php

1.4 - 25-Jul-21
o Added support from SMF 2.1 RC4
o SMF 2.1 RC3 - Fixed bug in GenericList.template.php and added support for multiple releases of SMF 2.1 RC3.
o Added Russian language support (thanks to wylekk (https://www.simplemachines.org/community/index.php?action=profile;u=608635)).
o Added support for LazyLoad (https://custom.simplemachines.org/mods/index.php?mod=4259) mod.
o Other minor enhancements.

1.5 - 01-Nov-21
o Fix for issue of broken image link showing for non-image files in Admin Center - reported by @rjen (https://www.simplemachines.org/community/index.php?msg=4101817).
o Added Dutch language support (thanks to @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786)).


License
Copyright (c) 2021 Kathy Leslie
All rights reserved

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer; and

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Image Attachment Thumbnail View
Post by: GigaWatt on January 11, 2021, 09:18:44 AM
Oh, this is really nice :). Good work :) ;).
Title: Re: Image Attachment Thumbnail View
Post by: Steve on January 13, 2021, 07:22:33 AM
Won't install on versions prior to 2.0.17?
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on January 13, 2021, 02:15:33 PM
Quote from: Steve on January 13, 2021, 07:22:33 AM
Won't install on versions prior to 2.0.17?
I haven't tested it on earlier versions so I don't know if/how it will install/work with them - I'll test it with some previous versions within the next few days and let you know.
Title: Re: Image Attachment Thumbnail View
Post by: Steve on January 13, 2021, 04:29:21 PM
Thanks GL. Appreciate it. :)
Title: Re: Image Attachment Thumbnail View
Post by: wylekk on January 14, 2021, 01:39:48 AM
Hi. For the SMF 2.1 RC3 forum will the mod be adapted?
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on January 14, 2021, 06:29:17 PM
Quote from: wylekk on January 14, 2021, 01:39:48 AM
Hi. For the SMF 2.1 RC3 forum will the mod be adapted?
I don't know but I will find out and let you know.
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on January 20, 2021, 03:28:19 AM
Uploaded v1.1 - 20 January 2021
o  Added installation support for SMF 2.0.10 through SMF 2.0.17 (installed and verified with all these versions)
o  Added Support for SMF 2.1 RC3 (installed and verified with all the officially released version and GitHub release as at 16 January 2021)
o  Added different background colour for unapproved attachments in Administration Center
o  Added option to enable thumbnail view separately for Admins and Moderators (these were combined in the previous release)
o  Moved the setting for viewing thumbnails in the Moderation Center to 'Administration Center » Attachments and Avatars » Attachment Settings' (this change was needed to ensure this feature works when a forum is upgraded to SMF 2.1 RC3)



Note: If you previously used v1.0 of this mod to view thumbnail-sized images in the Moderation Center you must enable and save the 'Display thumbnail view of unapproved image attachments in Moderation Center' setting in 'Administration Center » Attachments and Avatars » Attachment Settings' to enable this feature in v1.1.
Title: Re: Image Attachment Thumbnail View
Post by: Steve on January 20, 2021, 06:27:41 AM
Awesome. Thanks GL!  :D
Title: Re: Image Attachment Thumbnail View
Post by: wylekk on January 22, 2021, 10:50:55 AM
Thank you very much, everything works! :)
If necessary, here's the Russian language

$languagedir/index.russian.php

$txt['att_awaiting_approval'] = '<br /><em style="color: red;">(В ожидании подтверждения)</em>';


$languagedir/Admin.russian.php

$txt['moderation_center_view_thumbs'] = 'Показывать миниатюры неутвержденных прикрепленных изображений в Центре модерации';
$txt['attachment_manager_view_thumbs'] = 'Показывать миниатюры вложенных изображений в админке<div class="smalltext">Этот параметр применяется к вложениям, аватарам и миниатюрам в разделе «Просмотр файлов».</div>';
$txt['member_profile_view_thumbs_admin'] = 'Разрешить администраторам просматривать миниатюры вложенных изображений в профилях участников';
$txt['member_profile_view_thumbs_moderator'] = 'Разрешить модераторам просматривать миниатюры вложенных изображений в профилях участников';
$txt['member_profile_view_thumbs_other'] = 'Разрешить участникам просматривать миниатюры вложенных изображений в профилях участников';

Title: Re: Image Attachment Thumbnail View
Post by: Dave J on January 23, 2021, 09:45:31 AM
Works well on 2.0.17

Thank you
Title: Re: Image Attachment Thumbnail View
Post by: stoneageman on January 24, 2021, 05:54:58 PM
Very nice mod. Works a treat.Thanks GL  ;D
Title: Re: Image Attachment Thumbnail View
Post by: Dave J on February 14, 2021, 07:10:47 AM
Hi GL,

This has been causing an error on 2 different sites I manage

Both using 2.0.18
PHP 7

The error is seen in the attachments below and this is the line from the template

==>126: $aaa_pos = substr($row['name']['value'], -$aaa_length ) === $txt['att_awaiting_approval'];

I have now uninstalled the mod and the error doesn't happen anymore.

The error is apparent when you go to 'Users Online' and click on a staff members IP address.

I should add that at no time other than in that instance does the error happen.

Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on February 14, 2021, 04:30:23 PM
Hi Dave,

Quote from: Dave J on February 14, 2021, 07:10:47 AM
The error is seen in the attachments below and this is the line from the template

==>126: $aaa_pos = substr($row['name']['value'], -$aaa_length ) === $txt['att_awaiting_approval'];
I actually came across this issue myself just over a week ago and it has been fixed in the latest release (ie, v1.3).
Title: Re: Image Attachment Thumbnail View
Post by: Dave J on February 14, 2021, 05:10:08 PM
Thanks for the reply GL
Title: Re: Image Attachment Thumbnail View
Post by: Dave J on February 15, 2021, 04:32:18 AM
Hi

Again just to let you know that 1.3 is now working fine on both sites.

Thank you
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on February 15, 2021, 04:37:54 AM
Quote from: Dave J on February 15, 2021, 04:32:18 AM
Hi

Again just to let you know that 1.3 is now working fine on both sites.

Thank you
You're welcome - and thanks for letting me know!
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on July 26, 2021, 02:24:48 AM
Uploaded 1.4 - 25-Jul-21
o Added support from SMF 2.1 RC4
o SMF 2.1 RC3 - Fixed bug in GenericList.template.php and added support for multiple releases of SMF 2.1 RC3.
o Added Russian language support (thanks to wylekk (https://www.simplemachines.org/community/index.php?action=profile;u=608635)).
o Added support for LazyLoad (https://custom.simplemachines.org/mods/index.php?mod=4259) mod.
o Other minor enhancements.
Title: Re: Image Attachment Thumbnail View
Post by: @rjen on November 01, 2021, 04:11:12 AM
Just updated to version 1.4 and I am seeing that in the admin center it is trying to show thumbnails for attachements that are not images.

No I had some issues uninstalling version 1.0 of the MOD, so not sure it that has something to do with it...

Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on November 01, 2021, 06:27:45 AM
Uploaded 1.5 - 01-Nov-21
1.5 - 01-Nov-21
Fix for issue of broken image link showing for non-image files in Admin Center - reported by @rjen (https://www.simplemachines.org/community/index.php?msg=4101817).


Many thanks to @@rjen for reporting this bug.
Title: Re: Image Attachment Thumbnail View
Post by: @rjen on November 01, 2021, 07:20:29 AM
Find here the language strings in dutch...
<file name="$languagedir/index.dutch.php">
<operation> <!-- End of File -->
<search position="end" />
<add><![CDATA[
// Image Attachment Thumbnail View mod.
$txt['att_awaiting_approval'] = '<br /><em style="color: red;">(Wachtend op goedkeuring)</em>';
]]></add>
</operation>
</file>

<file name="$languagedir/index.dutch-utf8.php" error="skip">
<operation> <!-- End of File -->
<search position="end" />
<add><![CDATA[
// Image Attachment Thumbnail View mod.
$txt['att_awaiting_approval'] = '<br /><em style="color: red;">(Wachtend op goedkeuring)</em>';
]]></add>
</operation>
</file>

<file name="$languagedir/Admin.dutch.php">
<operation> <!-- End of File -->
<search position="end" />
<add><![CDATA[
// Image Attachment Thumbnail View mod.
$txt['attachment_manager_view_thumbs_settings'] = 'Instellingen voor \'Image Attachment Thumbnail View\'';
$txt['attachment_manager_view_thumbs'] = 'Toon miniaturen van afbeelding bijlagen in het beheercentrum <div class="smalltext">Deze instelling heeft invloed op bijlagen, avatars en miniaturen bij \'Bekijk bestanden\'.</div>';
$txt['moderation_center_view_thumbs'] = 'Toon minaturen van niet-goedgekeurde afbeelding bijlagen in het Moderatiecentrum';
$txt['member_profile_view_thumbs_admin'] = 'Toon beheerders miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['member_profile_view_thumbs_moderator'] = 'Toon moderators miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['member_profile_view_thumbs_other'] = 'Toon leden miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['att_awaiting_approval'] = '<br /><em style="color: red;">(Wachtend op goedkeuring)</em>';

]]></add>
</operation>
</file>

<file name="$languagedir/Admin.dutch-utf8.php" error="skip">
<operation> <!-- End of File -->
<search position="end" />
<add><![CDATA[
// Image Attachment Thumbnail View mod.
$txt['attachment_manager_view_thumbs_settings'] = 'Instellingen voor \'Image Attachment Thumbnail View\'';
$txt['attachment_manager_view_thumbs'] = 'Toon miniaturen van afbeelding bijlagen in het beheercentrum <div class="smalltext">Deze instelling heeft invloed op bijlagen, avatars en miniaturen bij \'Bekijk bestanden\'.</div>';
$txt['moderation_center_view_thumbs'] = 'Toon minaturen van niet-goedgekeurde afbeelding bijlagen in het Moderatiecentrum';
$txt['member_profile_view_thumbs_admin'] = 'Toon beheerders miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['member_profile_view_thumbs_moderator'] = 'Toon moderators miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['member_profile_view_thumbs_other'] = 'Toon leden miniaturen van afbeelding bijlagen in ledenprofielen';
$txt['att_awaiting_approval'] = '<br /><em style="color: red;">(Wachtend op goedkeuring)</em>';

]]></add>
</operation>
</file>
Title: Re: Image Attachment Thumbnail View
Post by: GL700Wing on November 01, 2021, 07:38:42 AM
Updated 1.5 - 01-Nov-21
1.5 - 01-Nov-21
o Fix for issue of broken image link showing for non-image files in Admin Center - reported by @rjen (https://www.simplemachines.org/community/index.php?msg=4101817).
o Added Dutch language support (thanks to @rjen (https://www.simplemachines.org/community/index.php?action=profile;u=287786)).


Many thanks to @@rjen for reporting this bug and for Dutch language support.