Advanced search  

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]

Pages: [1]   Go Down

Author Topic: stream plugin. Transforming the appearance of the thumbnail display.  (Read 6050 times)

0 Members and 1 Guest are viewing this topic.

406man

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 46

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.
« Last Edit: September 11, 2023, 04:27:43 pm by 406man »
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #1 on: August 14, 2023, 08:39:34 pm »

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
Logged
It is a mistake to think you can solve any major problems just with potatoes.

FrA1l3

  • Translator
  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Posts: 78
    • ACMSB
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #2 on: August 28, 2023, 06:30:47 pm »

Awesome work! I like it very much!  ;D
Logged

FrA1l3

  • Translator
  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Posts: 78
    • ACMSB
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #3 on: September 03, 2023, 01:51:40 pm »

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:
Code: [Select]
if (((($user == 0 ) && ($CONFIG['stream_user_choice'] == 2)) || (($user <> 0) && ($CONFIG['stream_user_choice'] > 0)))
to this:
Code: [Select]
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
Logged

406man

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 46
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #4 on: September 06, 2023, 05:42:25 pm »

Thanks for the feedback FrA1l3    I will investigate and respond.
Logged

406man

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 46
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #5 on: September 11, 2023, 04:28:17 pm »

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.
Logged

FrA1l3

  • Translator
  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Posts: 78
    • ACMSB
Re: stream plugin. Transforming the appearance of the thumbnail display.
« Reply #6 on: November 23, 2023, 11:26:13 pm »

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!!
« Last Edit: November 23, 2023, 11:50:24 pm by FrA1l3 »
Logged
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 19 queries.