forum.coppermine-gallery.net

Support => cpg1.6 plugins => cpg1.6.x Support => cpg1.6 plugin contributions => Topic started by: ron4mac on April 30, 2021, 01:36:40 am

Title: Fancybox media viewer
Post by: ron4mac on April 30, 2021, 01:36:40 am
This plugin leverages the fancybox javascript library (https://fancyapps.com/fancybox/3/) to provide an alternative full size viewing method for media (image/video).

It features zoom/pan, fullscreen, download, slideshow (albums) and right-click protect. It is touch-enabled, as well. Configure differently for each user group.

To be fully functional, it requires the newer version of jQuery (a javascript library) that comes with version 1.6.12 and later of CPG.

Versions prior to v1.4.0 function only when the CPG config option to go directly from thumbnails to the larger image is enabled. Version 1.4.0 and later does not have that restriction.

Update: v1.3 added ability to configure differently for each user group
Update: v1.3.2 made compatible with Lazy Load plugin
Update: v1.3.3 corrected unwanted auto-advance from video
Update: v1.3.4 use default display method for files not handed by FancyBox
Update: v1.3.6 added option to update view count for images
Update: v1.3.8 adds the capability to open image in an intermediate view (alt/option click thumbnail)
Update: v1.4.1 now functions in both gallery full image view modes (+bugfix for 1.4.0)
Update: v1.4.2 avoids keyboard slide navigation interference from other plugins
Update: v1.4.3 reduced possibility to interfere with other plugins

Title: Re: Fancybox media viewer
Post by: kodif on August 11, 2021, 01:52:48 am
Throws error when clicked "Album list">"Last comments" when comments has smileys

Quote
Fatal error: Uncaught Error: Call to undefined function process_smilies() in D:\Apache\htdocs\sites\galeria7\include\functions.inc.php:1183 Stack trace: #0 D:\Apache\htdocs\sites\galeria7\include\functions.inc.php(1525): build_caption(Array, Array) #1 D:\Apache\htdocs\sites\galeria7\plugins\fancybox\codebase.php(52): get_pic_data('lastcom', '2713', '<img src="image...') #2 D:\Apache\htdocs\sites\galeria7\include\plugin_api.inc.php(215): plg_fancybox_deploy('<!DOCTYPE html ...') #3 D:\Apache\htdocs\sites\galeria7\include\functions.inc.php(949): CPGPluginAPI::filter('gallery_header', '<!DOCTYPE html ...') #4 D:\Apache\htdocs\sites\galeria7\include\init.inc.php(442): load_template() #5 D:\Apache\htdocs\sites\galeria7\thumbnails.php(28): require_once('D:\\Apache\\htdoc...') #6 {main} thrown in D:\Apache\htdocs\sites\galeria7\include\functions.inc.php on line 1183
Title: Re: Fancybox media viewer
Post by: ron4mac on August 11, 2021, 01:44:44 pm
Thank you for your feedback.
See the updated version (1.1) above.
Title: Re: Fancybox media viewer
Post by: kodif on August 11, 2021, 05:40:56 pm
Yes, this is solved.

But..

Lets say that we have some users in our gallery.

On index page, we have "Last updated albums",  with thumbs and names of author.
After click on user name, we are redirected to his profile, where we can see
thumb "Last uploaded file. Click to see all uploads by ..."

After clicking, we are redirected to page with adress 
http://galery/thumbnails.php?album=lastupby&uid=...

and here, clicking on thumbs does nothing, but after reloading page in browser,
images are displayed correctly.
Title: Re: Fancybox media viewer
Post by: ron4mac on August 11, 2021, 08:25:48 pm
Wow! You should be a professional software tester.  ;)

See v1.2 above.
Title: Re: Fancybox media viewer
Post by: kodif on August 13, 2021, 01:41:11 pm
Actually, I am :)

I am glad I can help :)
Title: Re: Fancybox media viewer
Post by: merly on February 18, 2022, 04:31:23 pm
The plugin works perfectly for images but I have a couple questions regarding .mp4 videos ?

Videos only play once then stop, is there any way to make a video loop by default ?  I know it's possible to right click on a playing video and select 'loop' but that seems to be browser dependant and requires user interaction on every video, so I was wondering if there were any way to configure fancybox (or coppermine) to always loop ?

I've also found when an mp4 finishes it automatically switches to the next video, as though slideshow were permanently on ? I can't find any way to disable. It doesn't have this behaviour with images, only videos (or mp4 specifically, not tried other formats)

Am happy to edit code just for my own use, am just really stuck on this one, thanks !
Title: Re: Fancybox media viewer
Post by: ron4mac on February 18, 2022, 06:24:11 pm
I've also found when an mp4 finishes it automatically switches to the next video, as though slideshow were permanently on ? I can't find any way to disable. It doesn't have this behaviour with images, only videos (or mp4 specifically, not tried other formats)

I'll look into to that ... would seem to be a bug.
I'll also see what I can come up with about looping.
Title: Re: Fancybox media viewer
Post by: merly on February 18, 2022, 07:25:20 pm
thank you, much appreciated  8)
Title: Re: Fancybox media viewer
Post by: ron4mac on February 19, 2022, 12:53:11 am
See new version (1.3.3) above that corrects the unwanted advance of videos when not in slideshow.

I won't be looking at the possibility of a looping option until I have time to upgrade the plugin to use the 4th generation version of FancyBox (https://fancyapps.com/docs/ui/fancybox/).
Title: Re: Fancybox media viewer
Post by: merly on February 19, 2022, 04:11:33 pm
that's brilliant man, thanks for all your hard work, you're a legend  8)
Title: Re: Fancybox media viewer
Post by: merly on February 19, 2022, 06:13:02 pm
I managed to find a temporary solution.

In file : \fancybox\fb\jquery.fancybox.min.js

Find : video class="fancybox-video"

Replace with : video class="fancybox-video" loop=""
Title: Re: Fancybox media viewer
Post by: ron4mac on February 19, 2022, 06:57:04 pm
I managed to find a temporary solution.

In file : \fancybox\fb\jquery.fancybox.min.js

Find : video class="fancybox-video"

Replace with : video class="fancybox-video" loop=""
;)
Title: Re: Fancybox media viewer
Post by: Radioven on June 09, 2022, 03:53:59 pm
Hallo,
ich habe die Fancybox v1.3.4 installiert, die auch soweit funktioniert. Seit der Installation dieses Plugins werden aber nur noch die Aufrufe von Videos (.mp4) gezählt, die von Fotos (.jpg) nicht mehr. Bei Fotos wird auch der entsprechende Timestamp (mtime) in der Datenbank nicht mehr aktualisiert. Die Zählung der Albenaufrufe funktioniert dagegen weiterhin. Woran kann das liegen?

Coppermine Photo Gallery 1.6.19
Fancybox Media Display v1.3.4
PHP 8.0.19

Gruß
Radioven
Title: Re: Fancybox media viewer
Post by: Radioven on June 21, 2022, 03:28:40 pm
Problem has been solved with version 1.3.6.
Title: Fancybox media viewer
Post by: KchoPrro on August 29, 2022, 08:29:56 pm

Update: v1.3.8 adds the capability to open image in an intermediate view (alt/option click thumbnail)
Update: v1.4.0 now functions in both gallery full image view modes

Thank you very much for continuing to improve the plugin.
I imagine that the user will have to choose between the two versions; 1.3.8 and 1.4.0 depending on whether you need to open the image from the thumbnails or from the gallery intermediate images. I have tested version 1.4.0 and it works correctly although it has fewer configuration options than version 1.3.8 (I imagine that is logical). I have detected 4 problems (in case you are interested in reviewing them):

Problem 1: When the image is not the right size (vertical images in my case), the plugin does not open the image, you have to find a larger image, open it, and then go back to see the previous one. For Example;
https://www.adolfoventas.es/galeria/displayimage.php?album=42&pid=511#top_display_media

Problem 2: I don't quite understand how the background darkening option works. In my case, whatever percentage I indicate does not change the color of the background.

Problem 3: The function add the number of views of the image does not work (I do not see that it changes anything).

Problem 4: For some reason, it doesn't work well in many albums, even removing the slider buttons in the image menu. For example;
https://www.adolfoventas.es/galeria/thumbnails.php?album=12

Personally, I think it would be nice if the plugin allowed to add or not the image description and title. I find that slideshows look prettier if only the image and image title are displayed.

I will leave the plugin active for a few days in my gallery, in case you want to see how it works with my albums:

I am attaching a screenshot of the settings. I also attach the Spanish language.
Title: Fancybox media viewer
Post by: ron4mac on August 30, 2022, 01:46:56 pm
Quote
Problem 1: When the image is not the right size (vertical images in my case), the plugin does not open the image, you have to find a larger image, open it, and then go back to see the previous one. For
Part of the core CPG behavior is that, when an uploaded image is too small relative to your config file settings, a link to the full-sized is not created on the intermediate display because the image is already being displayed fully. Without that link, the substitution for the alternate view method was not occurring. I have found a method to get around that.

Quote
Problem 2: I don't quite understand how the background darkening option works. In my case, whatever percentage I indicate does not change the color of the background.
It should probably be called 'Background Opacity'. It is a measure of how opaque the slide background (black) is. Since your gallery background is black, it would be hard to notice any difference.

Quote
Problem 3: The function add the number of views of the image does not work (I do not see that it changes anything).
The hit count is subject to gallery settings. If browsing as an admin, the default is to not update hit counts.

Quote
Problem 4: For some reason, it doesn't work well in many albums, even removing the slider buttons in the image menu. For example;
https://www.adolfoventas.es/galeria/thumbnails.php?album=12
I'm not sure what is causing this ... it seems to only be an issue with that one category. I'll work at seeing if I can duplicate the condition.

Quote
Personally, I think it would be nice if the plugin allowed to add or not the image description and title. I find that slideshows look prettier if only the image and image title are displayed.
I certainly agree. I should have had options for that from the beginning. It was probably something I thought I would do later (after it was functioning otherwise) but then forgot about it. I'll include options for what text is shown.

Thank you for your feedback and helping me with this plugin.
Title: Re: Fancybox media viewer
Post by: ron4mac on August 30, 2022, 06:00:33 pm
Here is an updated version with Problem #1 hopefully solved. And it has options for the display of text.

Problem #4 is quite weird and I don't yet see how it is happening. I see what is wrong but I believe it could only happen with interference from something else. Could you please give me a list of plugins that you have installed? Or, if you feel like it, you could disable some of your plugins to see if that one category works okay with them disabled.
Title: Re: Fancybox media viewer
Post by: KchoPrro on August 30, 2022, 08:09:57 pm
Here is an updated version with Problem #1 hopefully solved. And it has options for the display of text.

Problem #4 is quite weird and I don't yet see how it is happening. I see what is wrong but I believe it could only happen with interference from something else. Could you please give me a list of plugins that you have installed? Or, if you feel like it, you could disable some of your plugins to see if that one category works okay with them disabled.

I don't know what you have done, but this version that you have uploaded has solved all 4 problems. Is incredible.

You can check it again, I have not touched anything, I have removed the previous version and uploaded the latest one (I have added the Spanish language) and everything works now as it should, and I can decide whether to add the description or just the title


Again, thank you very much for your great work  ;)
Title: Re: Fancybox media viewer
Post by: ron4mac on August 30, 2022, 10:17:05 pm
Great! I'm glad it is working better for you.  I see that the keyboard_navigation plugin that you are using does not get along well with Fancybox.

I may make a couple more changes/additions to it. Then maybe you could provide updated Spanish language for it.
Title: Re: Fancybox media viewer
Post by: KchoPrro on August 31, 2022, 07:45:50 am
How odd! Yesterday I thought it was working, but today I see that problem 4 has not been solved.

Sorry, I did not put the plugins that I currently have active and installed. Are these;

Installed and Active Plugins:
MiniCMS (minicms): v2.5
Keyboard Navigation (keyboard_navigation): v1.5
Subir CoreH5A (upload_h5a): v1.1
Subir CoreSWF (upload_swf): v1.0
Subir CoreSGL (upload_sgl): v1.0
BBCode Control (bbcode_control): v1.9
Fancybox Media Display (fancybox): v1.4.0

Installed plugins NOT active:

HTML5 Slideshow (html5slideshow): v1.4.6
LightBox NotesFor.net (lightbox_notes_for_net): v3.4

Plugins NOT installed:
(link_target): v1.2
(onlinestats): v2.7
Panorama Viewer (panorama_viewer): v1.4 -->I installed it to try an alternative image viewer but found it didn't do what I thought it would. I uninstalled it.
Plugin de ejemplo (sample): v1.8
(usergal_alphatabs): v1.6
Visible HookPoints (visiblehookpoints): v4.1

It may be a good idea to disable plugins and test how Fancybox Media Display works, it is possible that you can detect which plugin is affecting it.
Title: Re: Fancybox media viewer
Post by: ron4mac on August 31, 2022, 01:45:12 pm
How odd! Yesterday I thought it was working, but today I see that problem 4 has not been solved.

When I view your site I don't see the problem 4 where I did before  ???  I'm not sure how you are seeing it.
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 01, 2022, 07:49:54 am
When I view your site I don't see the problem 4 where I did before  ???  I'm not sure how you are seeing it.

Sorry  :-[, I was looking at my website from another computer and I hadn't refreshed my browser's cache. Now that I've seen it again, the problem is gone.
Title: Re: Fancybox media viewer
Post by: ron4mac on September 05, 2022, 02:43:35 pm
I see that the keyboard_navigation plugin that you are using does not get along well with Fancybox.

I may make a couple more changes/additions to it. Then maybe you could provide updated Spanish language for it.

Version 1.4.2 of this plugin avoids keyboard navigation interference.
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 10, 2022, 08:33:16 pm
Version 1.4.2 of this plugin avoids keyboard navigation interference.

Thanks ron4mac.

I have installed this latest update and have noticed strange behavior.

- The plugin does not work when we enter from lastup (this happened to me at the beginning and you found the solution). I check that it only happens when I activate the title or description.

- The plugin does not work on some albums when I activate the description.

When I do not have these two functions active, the plugin works correctly. I leave it configured like this in case you want to confirm it:
https://www.adolfoventas.es/galeria/displayimage.php?album=lastup&cat=0&pid=1101#top_display_media
https://www.adolfoventas.es/galeria/thumbnails.php?album=21

When I do not have these two functions active, the plugin works correctly. I leave it configured like this in case you want to confirm it:

In these cases, the play button in the image menu also disappears. I think it's the same symptoms I had initially. On the other hand, the function to show the number of times seen does not appear.

Thanks ;)
Title: Re: Fancybox media viewer
Post by: ron4mac on September 11, 2022, 02:54:42 pm
Installed and Active Plugins:
Keyboard Navigation (keyboard_navigation): v1.5
BBCode Control (bbcode_control): v1.9


These plugins are out of date. The BBCode Control plugin is definitely not compatible with CPG 1.6 and is likely what is causing your current issue with the FancyBox Media Viewer.
If you need to use these plugins, please update them to the CPG 1.6 versions.
https://forum.coppermine-gallery.net/index.php/board,143.0.html
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 12, 2022, 08:19:06 am
These plugins are out of date. The BBCode Control plugin is definitely not compatible with CPG 1.6 and is likely what is causing your current issue with the FancyBox Media Viewer.
If you need to use these plugins, please update them to the CPG 1.6 versions.
https://forum.coppermine-gallery.net/index.php/board,143.0.html

That shouldn't be the problem. I have uninstalled those two plugins and have not solved the problem. I have installed the CPG Vs. 1.6 plugins and have not solved the problem either. I don't know what changed in this new version of Fancybox but the one you attached to me in a previous message worked fine. It's strange  ???.
Title: Re: Fancybox media viewer
Post by: ron4mac on September 12, 2022, 02:26:11 pm
It definitely is strange!  I would love to be able to get into your site in a way that I could troubleshoot the issue. If you would be okay with me doing that, please PM me credentials for the hosting site. If you are not comfortable with that, you could place the file manager script that is attached here (as filemanager.php) in the root of your gallery. That file will allow only me to browse your files and make modifications. If you don't like the idea of either of those options, could you please replace your gallery file include/themes.inc.php with the one attached here. It may help reveal the core of the problem (which may be a general CPG issue, not just a plugin issue).
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 12, 2022, 09:01:32 pm
It definitely is strange!  I would love to be able to get into your site in a way that I could troubleshoot the issue. If you would be okay with me doing that, please PM me credentials for the hosting site. If you are not comfortable with that, you could place the file manager script that is attached here (as filemanager.php) in the root of your gallery. That file will allow only me to browse your files and make modifications. If you don't like the idea of either of those options, could you please replace your gallery file include/themes.inc.php with the one attached here. It may help reveal the core of the problem (which may be a general CPG issue, not just a plugin issue).

Ok, I have already uploaded filemanager.
I have changed the themes.inc.php file that you have attached for the one from my hosting but I have not seen that anything has changed. I hope filemanager helps you understand what might be going on.

Sorry if I insist, but the plugin worked fine with the one you attached in a previous message (you edited the message and removed the plugin), it was when I updated to the new version that this problem appeared, and it only happens when I have the functions of display title or description.

I also don't see any differences when I activate the display function "Add to image view counts", what should I see?, any example?
Title: Re: Fancybox media viewer
Post by: ron4mac on September 12, 2022, 11:43:42 pm
The issue is that some of your image titles or descriptions contain malformed UTF8 characters. The PHP function that the CPG core uses to encode data sent to your web browser fails to encode these data because of those malformed UTF8 characters. The PHP version used on your site (v7.0.33) is rather old and cannot overcome this issue. If your PHP was upgraded to 7.4, it could be made to ignore these malformed characters rather than failing. That is why it works okay if you are not including the titles and descriptions.

[edit]
I made a change to your copy of the FancyBox plugin that gets around the character encoding failure problem although the displayed text will have some garbled characters ... but at least the images will display.
Title: Re: Fancybox media viewer
Post by: ron4mac on September 13, 2022, 12:16:23 am
Sorry if I insist, but the plugin worked fine with the one you attached in a previous message (you edited the message and removed the plugin), it was when I updated to the new version that this problem appeared, and it only happens when I have the functions of display title or description.
That version was working for you because you didn't have titles or description set to be displayed.
Quote
I also don't see any differences when I activate the display function "Add to image view counts", what should I see?, any example?
You have to have 'hit' counts enabled in you gallery config as well as displaying the 'hit' count with the thumbnails.
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 13, 2022, 07:45:22 am
The issue is that some of your image titles or descriptions contain malformed UTF8 characters. The PHP function that the CPG core uses to encode data sent to your web browser fails to encode these data because of those malformed UTF8 characters. The PHP version used on your site (v7.0.33) is rather old and cannot overcome this issue. If your PHP was upgraded to 7.4, it could be made to ignore these malformed characters rather than failing. That is why it works okay if you are not including the titles and descriptions.

[edit]
I made a change to your copy of the FancyBox plugin that gets around the character encoding failure problem although the displayed text will have some garbled characters ... but at least the images will display.

Ok, I understand the problem. In the end, again the UTF encoding error comes out again which I was able to resolve by selecting latin.

The PHP version of my CPG is 7.0 because it is the highest version that works well for me (7.1, 7.2, 7.3 and 7.4 do not show me the web correctly and version 8.0 directly does not show me anything). This was a problem to check later, running with 7.0 was enough for me, now I see that it is not.

Actually, I will never use the description in fancybox, I don't like the result because I have a lot of text in each image. It is not a problem for me that some words do not look good.

Thanks for the help.
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 13, 2022, 07:51:00 am
That version was working for you because you didn't have titles or description set to be displayed.

Are you sure?  ??? I think I tried everything. I find it weird that I would leave it working without enabling titles, for me displaying the image title in fancybox is essential  8).

You have to have 'hit' counts enabled in you gallery config as well as displaying the 'hit' count with the thumbnails.

Aaaaaaah!, Ok, now I understand. I will try it ;)  ;)
Title: Re: Fancybox media viewer
Post by: ron4mac on September 13, 2022, 05:18:44 pm
The PHP version of my CPG is 7.0 because it is the highest version that works well for me (7.1, 7.2, 7.3 and 7.4 do not show me the web correctly and version 8.0 directly does not show me anything). This was a problem to check later, running with 7.0 was enough for me, now I see that it is not.
Taking all the tires off your car because one is flat and it doesn't look good with just one flat is probably not a good solution for the problem. It would probably be safer to fix the flat.  ::)  (yeah, I know ... I suck at analogies)
Title: Re: Fancybox media viewer
Post by: KchoPrro on September 13, 2022, 07:59:23 pm
Taking all the tires off your car because one is flat and it doesn't look good with just one flat is probably not a good solution for the problem. It would probably be safer to fix the flat.  ::)  (yeah, I know ... I suck at analogies)

LOL! I understand! That's why I just asked in the themes section about the problem of PHP versions and my chaoticsoul theme, I think it's time to try to make it work at least with PHP7.4 ;)
Title: Re: Fancybox media viewer
Post by: KchoPrro on October 30, 2022, 11:07:30 am
Sorry if the question is irrelevant. Would it be possible to change the look of fancybox in CPG?

I have seen the website of https://fancyapps.com and the example slideshow is quite good:

https://fancyapps.com/docs/ui/fancybox/#demo-1

The images move horizontally in transition, the arrow icons look more aesthetic to me, and you have the option to show or not the carousel if there is more than one image.

I have tried to check the configuration but it is too complicated for me, you have done a fabulous job ron4mac.
Title: Re: Fancybox media viewer
Post by: ron4mac on October 30, 2022, 03:49:59 pm
The version of the code used on their website (4.x) is no longer an open source project and requires licensing. I used version 3.x in my plugin, which was more freely usable.
I have considered paying for use of their new code, but there have been a few things stopping me:
1) performance - When I last tested it, it didn't seem to function a crisply as the v3 code. And there were/are some bugs with slideshow video.
2) time - Finding the time to figure out how to wedge the very different code into my plugin doesn't come easy.
3) effort vs return - I don't even use CPG - so it provides nothing for me. And I have grown very annoyed with take-but-not-give that is now pervasive in our world.

With all that - an upgrade is not beyond the realm of possibility sometime in the future.
Title: Re: Fancybox media viewer
Post by: KchoPrro on October 30, 2022, 07:30:51 pm
The version of the code used on their website (4.x) is no longer an open source project and requires licensing. I used version 3.x in my plugin, which was more freely usable.
I have considered paying for use of their new code, but there have been a few things stopping me:
1) performance - When I last tested it, it didn't seem to function a crisply as the v3 code. And there were/are some bugs with slideshow video.
2) time - Finding the time to figure out how to wedge the very different code into my plugin doesn't come easy.
3) effort vs return - I don't even use CPG - so it provides nothing for me. And I have grown very annoyed with take-but-not-give that is now pervasive in our world.

With all that - an upgrade is not beyond the realm of possibility sometime in the future.

Great and wise answer from you.

Now I understand perfectly, if you don't use CPG of course you have earned heaven for everything you do for CPG.

Thank you very much for all the work you put in and for answering users' questions, it's a great effort of yours, I can keep Fancybox as it is right now  :-*