stream plugin. Transforming the appearance of the thumbnail display. stream plugin. Transforming the appearance of the thumbnail display.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

stream plugin. Transforming the appearance of the thumbnail display.

Started by 406man, August 13, 2023, 01:58:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

406man

Introduction
The thumbnail display is right at the core of Coppermine and drives user impressions. The users of my gallery said that they thought the grid display of thumbnails is a little small and old-fashioned and could anything be done to update it ? In this age of Flickr and other galleries I thought this was, on balance, fair comment and looked around for something suitable. I couldn't find anything in the existing set of plugins so set about creating a plugin myself which would deliver an updated user experience. It was inspired by Flickr but is not the same. Having used it in my gallery I thought I would share it with the wider user community. Right up front I will warn that there are measures that need to be taken to ensure adequate performance and I'll cover these later but it will run, although slower than is ideal, without making any changes. When you uninstall the plugin, either all changes made to the database are removed or there is an option to keep them. The plugin ought to be viewed as a Beta test version until a reasonable selection of galleries have installed it and are happy with its appearance and performance. I've tested it with PHP 7 and 8 and the standard themes. Feedback welcome.

Features
The thumbnail pictures are displayed much larger than in the conventional grid and form a continuous stream across the page. The width and maximum & minimum height of the stream and number of pictures on each page are configurable.

I've aimed to match its appearance with existing galleries by picking up theme fonts and colours using the theme's CSS and also using many of the configuration options such as display of comments, ratings and description. The plugin configuration option screen contains various settings but can be run on the defaults without making any changes after installation. Simply install it and go, without accessing the plugin configuration screen. You might find that images are slow to load, however. A couple of screenshots are attached to demonstrate the display.

Some users might not like the visual change or performance impact so there is the option of switching back to the standard thumbnail grid. The ability to do this can be set for either:
1.   All users
2.   Logged in users only   (this is the default)
3.   No users get a choice
The preferred option is chosen by the administrator in the plugin options. The choice of grid / stream is remembered for logged in users.

The radio buttons to choose between stream and grid are, by default, in a separate row on the screen. To save vertical screen space this can be changed so that the buttons are combined with the Title row. I've tested this with all the themes supplied as standard and it works fine but it's possible that it doesn't work properly with home-cut themes or plugins that I haven't loaded. For this reason I've set the default to the safest option – separate row. I recommend checking out the "In the Title line" configuration option to see if it works for your gallery.

It's worth mentioning that I couldn't find a way of implementing the "Title row" mode selector with the meta-albums like "Last Uploads " and "Most Viewed" due to a limitation in the code in function theme_display_thumbnails in themes.inc.php. This means that even if you choose to have the menu in the Title row, it will change to a menu below the Title row when a meta-album is chosen on the gallery's main menu.

The standard grid-format thumbnails have various settings in the "Thumbnail view" section of the existing administrator's configuration screens. For example: "Display uploader name below the thumbnail" and "Display rating below the thumbnail". Stream displays the following:
•   Title (always displayed)
•   Uploader name (depending on config setting)
•   Rating (depending on config setting)
•   Number of comments (depending on config setting)
•   Caption (depending on config setting). If enabled, the caption is superimposed on the image when the mouse pointer hovers over it
•   Number of views (depending on config setting)

The administrator can choose the height and width of the stream images and the border size in the plugin configuration options. I recommend leaving these settings at their defaults.

Performance
The images displayed in the stream are much larger than the standard thumbnails so, to maintain quality, are downsized from larger images. If intermediate images have been enabled these are used and resized. If not, the full-size images are used and downsized. Use of full-size images may lead to slow performance on many setups, particularly when the hosting server is moderately loaded or the viewer has a slow network link. The Coppermine documentation has a good description of the use of intermediate images here: https://coppermine-gallery.net/docs/curr/en/start.htm#getting_resizing_intermediate
Performance is much better if intermediate images have been enabled but this opens up some potential new problems. I'll deal with these in two scenarios:

Scenario 1. Intermediate images haven't been enabled yet.
Performance of the stream will depend on the dimensions of your full-size images. If they are around 800 pixels high, or larger, use of intermediate images will give a good improvement but brings a disadvantage. With standard Coppermine when intermediate images are not used and Image View is displayed by clicking on a thumbnail, the full-size image is displayed. In contrast, when intermediate images are enabled, clicking on a thumbnail displays the intermediate image. As this is usually much smaller than the full-size image a disappointing visual experience will be delivered compared to the way the gallery behaved previously.

There is also the situation that straight after the moment when you enable intermediate images in an existing gallery you will have a gallery where the code wants to use intermediate images but they don't exist. It's important to use the Admin Tools feature to create them. From this point onwards, the upload process will create intermediate images for newly uploaded images.

The stream plugin has a couple of features to deal with both the points raised above. Firstly, if intermediate images are enabled but a particular intermediate image doesn't exist it will downsize the full-size image. There is no error message, just a slower download and image display. Secondly, the plugin can optionally make a temporary change to fool the Image Display screen in displayimage.php into thinking that intermediate images aren't being used and it displays the full-size image instead. In other words, the same behaviour as before intermediate images were enabled. This feature in the plugin is called "When intermediate images are used, override display of intermediate image: use the full size image instead". This should be set to "Display full size image".

Scenario 2. The gallery is already using intermediate images.
For best performance it's recommended that the height of the stream is set to be the same as the height of the intermediate images or less to minimise the amount of downsizing. If the existing intermediate images are larger than the maximum stream height there won't be a problem with image sharpness but they will have to be downsized to fit the stream and there could be a performance impact. If the existing intermediate images are smaller than the stream height they will have to be enlarged to fill the space and the image may appear fuzzy. Because changing existing gallery settings may degrade the display of images if enlargement is required, it may be necessary to experiment with image sizes. My recommendations for settings are below. If the existing intermediate images are smaller than around 350px high – or vary in height – it's worth considering recreating them with revised dimensions using the Admin tools to deliver the best visual experience.

Recommended Settings for intermediate images used with Stream
Intermediate images are enabled with the "Create intermediate pictures" option in the "Image Settings" section of the standard Gallery Configuration screens. I recommend that the drop down box "Use dimension" is set to Height and the "Max width or height of an intermediate picture" set to the same value in pixels as the maximum height of the stream (default is 350px).  This will create images with a consistent height which is beneficial for the stream display. You can create intermediate images for images that have already been uploaded using the Admin Tools option on the Adminstrator's menu. Choose the "Update thumbs and/or resized photos" option followed by the "Only resized pictures" option and "All Albums". It seems a solid, reliable utility and I've not seen any timeout problems despite the length of time needed for resizing all the pictures in a gallery. A gallery with over 7,000 pictures took about half an hour for the resizing process to create all the intermediate images.

Limitation
If all users are allowed to choose whether to have grid or stream mode, the users who aren't logged in will get an inconsistent experience as the gallery won't remember which mode they have set. It might be technically possible to implement this but is beyond my knowledge at the present time. Because of the limitation, I recommend only allowing logged-in users to be able to choose the mode.

Finally
This is Version 1.0 so it's inevitable that there will be bugs and quirks, especially in scenarios that I haven't been able to test. It has been tested with PHP 7 and 8.2.0. It will not work with Coppermine 1.5.x versions or with PHP 5. Feedback in the forum is welcome. If it's about a bug please include a screenshot of the error message and information on the relevant configuration options.

-----------------
Edited 8 June 2024 and updated to V1.1.1   Fixes bugs with:
i) Display of video and other non-image file types. 
ii) Display of albums populated with images using keywords

-----------------
Edited 24 June 2024 and updated to V1.1.2 
Adds a couple of features requested by one of the users:
i) Stream can now contain a maximum of 1000 images instead of 100
ii) Page navigation can optionally be added above the stream


phill104

A brief look and it seems you have done a great job. Excellent write up too. I shall take a closer look when I get time. Thanks for your efforts
It is a mistake to think you can solve any major problems just with potatoes.

FrA1l3


FrA1l3

Hello,
I have seen one thing and that is that even if you choose in the configuration not to show the switch "Allow users to choose stream or grid thumbnail display",
It does not work, I mean in my case it does not matter what you configure.

I fixed it by making this modification in the file display_stream.inc.php
from this:
if (((($user == 0 ) && ($CONFIG['stream_user_choice'] == 2)) || (($user <> 0) && ($CONFIG['stream_user_choice'] > 0)))

to this:
if (((($user == 0 ) && ($CONFIG['stream_user_choice'] == 2)) || (($user <> 0) && ($CONFIG['stream_user_choice'] > 0 && GALLERY_ADMIN_MODE)))


It is not an arrangement as is, it is a workaround, at least that way the selector does not appear (in any case really).
If I leave the selector visible and you choose the grid, it disappears and does not allow you to put the stream back on unless you go into the configuration and save it again.

thank you

406man

Thanks for the feedback FrA1l3    I will investigate and respond.

406man

I've checked the code and can confirm there's a bug in version 1.0.

The plugin configuration allows the grid / stream selector to be displayed either in the title line of the gallery or in a separate line under the title line. It's up to the gallery administrator whether they want to save screen space by incorporating the selector in the title line or not. The default is to use a separate line.

The selector can be used by either: All users, logged-in users only, or no users.
When the selector was incorporated in the title line it worked correctly. When the option was chosen to display the selector in its own line it was always displayed instead of only being displayed to users who were permitted to use it.

I've changed the code in display_stream.inc.php to fix the bug and also slightly restructured it to make clearer how this part of the logic works.

Version 1.01 is now available for download in the first message in this thread.
Anyone running version 1.00 can avoid the bug by configuring the plugin to display the grid / stream buttons in the Title line.

Thanks to FrA1l3 for reporting the bug.

FrA1l3

Hello!

Anytime!
Thank you for your work!

Edited:
I had originally posted this post: https://forum.coppermine-gallery.net/index.php/topic,80766.0.html, but after discovering the configuration error, I am now calmer knowing that it is not a plugin thing. Although you might like to know that if you activate the "Insert a transparent overlay to minimize image theft" option with the plugin active, it does that strange thing that I shared in the video.

thank you!!

droneguy

Thanks for this - just installed Coppermine for the first time, this plugin definitely gives it a more modern look!

David

droneguy

This plug-in really is great, but - it seems it can't handle a non-image file in the gallery.  I added an MP4 file and it causes the stream display to crash.  It crashes because when trying to retrieve the EXIF data to check for orientation the exif function fails and doesn't return an array.  Also, although the next problem doesn't cause a crash it's unable to display a thumbnail when building the page (I'm guessing because a video file doesn't have a thumbnail?)

I've fixed this by checking that the exif data returned is actually an array, and skipping if it's not.  Also also hard-coding a check for MP4 filetype when building the thumbnails and have it use the 'thumb_movie.png' file instead.  It works, but my PHP is limited so it's very much a botch.

406man

Thanks for your comments, droneguy. Am pleased that you like the plugin. I only developed it to support images but it shouldn't crash with other files. I'm working on an update for other reasons so will investigate the crash you saw and release a version that fixes the problem.

nambroque

Hello!
Great plugin, but in my case it's not wothful, as pblic albums contain linked files, and they do not appear when you choose stream display
I suppose there is not any solution for this  :-\
My gallery:
Galería Fotometeo

406man

Quote from: nambroque on May 15, 2024, 11:25:28 AM
Hello!
Great plugin, but in my case it's not wothful, as pblic albums contain linked files, and they do not appear when you choose stream display
I'm working on a revised version of the plugin which will cope with various types of file and may be able to include a fix to what you've described but I'll need a little more information to understand the circumstances. Can you say what type of file it is or, if it is a gallery that's open to the public, give me a link to a standard thumbnail page that shows the linked files.

nambroque

Thanks for your quick reply.
I'm glad to know you are wokimg on a revised version
I'll try to explain much better:
In my gallery users are allowed to upload pictures only to their personal albums, and then their pictures are are linked by the admins to the corresponding public albums through the keywords. So if you visit my gallery and go to any of the public albums you will find at the main index, they contain only linked files. So, if you choose stream to see the thumbnails you will see no picture, for instance:
https://fotometeo.ame-web.org/thumbnails.php?album=4220

My gallery:
Galería Fotometeo

406man

Quote from: nambroque on May 15, 2024, 11:48:44 AM
So, if you choose stream to see the thumbnails you will see no picture, for instance:
https://fotometeo.ame-web.org/thumbnails.php?album=4220
Thanks for the link. I took a look at your site and the pictures are brilliant. Where the stream works the pictures look great in stream format, for example on this link:
https://fotometeo.ame-web.org/thumbnails.php?thumb_mode=stream&album=690&page=1&cat=-690

Unfortunately, I've not used keywords in that way in my gallery and the current version of stream doesn't support them. I will see what I can do to support keywords in the next release of stream, hopefully in the next few weeks.

nambroque

Thank you very much.
Looking forward to have good news from you!  :)
My gallery:
Galería Fotometeo

406man

I've created Version 1.1 of the plugin to fix the problems described by droneguy and nambroque. It now supports non-image files such as video (.mp4). It also supports images that are in galleries populated by using keywords. It would help me if anyone who had problems as described above could test the new version and let me know if it fixes their problems.  When I know it's working in these scenarios I'll replace version 1.0 at the beginning of this forum thread.

With the new version there are no database changes so all you need to do is replace the contents of the existing stream directory in the plugins directory with the new version of the plugin after unzipping it.

(Edited to remove download of Version 1.1)

nambroque

Thanks 406man
It works but "not always":
If you go to an album were all pictures are linked there by the keywords, and you chose stream, you will see no picture (nothing has changed from version 1.0 to 1.1)
But if you click on "Top rated", "Last hits" etc. then pictures appear
My gallery:
Galería Fotometeo

nambroque

I will keep plugin active in my gallery so you can check it
My gallery:
Galería Fotometeo

406man

Thanks nambroque for testing the updated plugin and apologies that it didn't work properly. The stream displayed correctly with my test album but not with an album set up with only keyworded images. I've fixed the bug now and apologise again for the inconvenience. Try out version 1.1.1 and let me know how it goes.

nambroque

My gallery:
Galería Fotometeo