• Purchasing a license grants permission to use the software and to get Tech Support. A license purchase doesn't grant customization support.

Auto-animate GIF thumbnails

bleached

New Member
Joined
Jul 26, 2019
Messages
4
Points
1
Hello,

I recently setup a new Chevereto site. Overall, liking the software very much. There are a couple of things I'd like to customize, and I'm sure I need some help with this.

A big item I would like to have on my image gallery is auto-animated thumbnails.

Instead of loading this GIF thumbnails as a still picture (requiring a click to animate them), how can I change it so it loads the fully animated image, instead? (I am aware that this will increase load times for the users due to increased GIF file sizes)

Take this page for example (http://www.gifyu.com/explore/recent). I would like to see it where the GIF pics all are animated without any input necessary from the person browsing the site.

I am pretty much clueless on which files to edit to accomplish this, or what lines of code need to be changes. Any help would be greatly appreciated. Thank you!
 

jeffrose

Core license
License owner
Joined
Jan 6, 2018
Messages
22
Points
53
Location
Vancouver, Canada
Website
microsclae.pics
Looks like app/lib/functions.render.php at line 429 - 432 has the code that determines if it's an animated .gif and whether to switch to the .gif loading. I haven't tried it or played with it at all but that would be a starting point.

Dozens of animated .gif images all loading would be.... annoying to anyone viewing it.
 
  • Like
Reactions: bleached

bleached

New Member
Joined
Jul 26, 2019
Messages
4
Points
1
Yep, that looks like it should hopefully fix it.

Unfortunately for me, I am completely clueless when it comes to coding. Can anybody tell me which lines need to be changes in order to achieve the desired effect? Thanks again!
 

Dax

Core license
License owner
Joined
Mar 19, 2016
Messages
10
Points
53
I think this is what you'll need:

Patch:
--- a/app/lib/classes/class.image.php    2019-07-29 00:43:13.725946292 +0100
+++ b/app/lib/classes/class.image.php    2019-07-29 00:44:18.524458721 +0100
@@ -1525,6 +1525,10 @@
 
         $image['size_formatted'] = G\format_bytes($image['size']);
 
+        if ($image['is_animated']) {
+            $display = $image;
+        }
+
         $image['display_url'] = $display['url'];
         $image['display_width'] = $display_thumb ? getSetting('upload_thumb_width') : $image['width'];
         $image['display_height'] = $display_thumb ? getSetting('upload_thumb_height') : $image['height'];
diff -ru a/app/lib/functions.render.php b/app/lib/functions.render.php
--- a/app/lib/functions.render.php    2019-07-29 00:43:29.433070504 +0100
+++ b/app/lib/functions.render.php    2019-07-29 00:46:26.157468053 +0100
@@ -425,13 +425,7 @@
         $item['liked'] = is_null($item['like']['user_id']) ? 0 : ($requester['id'] == $item['like']['user_id'] ? 1 : 0);
     }
 
-    if ($stock_tpl == 'IMAGE') {
-        if (!$item['is_animated'] || !isset($item['file_resource']['chain']['image'])) {
-            $conditional_replaces['tpl_list_item/item_image_play_gif'] = null;
-        }
-    } elseif (!isset($item['images_slice'][0]['is_animated']) || $item['images_slice'][0]['is_animated'] == false) {
-        $conditional_replaces['tpl_list_item/item_image_play_gif'] = null;
-    }
+    $conditional_replaces['tpl_list_item/item_image_play_gif'] = null;
 
     $fill_tpl = $tpl;
 

bleached

New Member
Joined
Jul 26, 2019
Messages
4
Points
1
Thank you so much for your help!

Do I just copy/paste that into the "app/lib/functions.render.php" file, replacing the part where it says "if ($stock_tpl == 'IMAGE') {" etc, etc...?

Or does this need to be pasted somewhere in the "app/lib/functions.render.php" file?

Sorry for my technical ineptitude. I can PayPal you some money for your help if need be.
 

jeffrose

Core license
License owner
Joined
Jan 6, 2018
Messages
22
Points
53
Location
Vancouver, Canada
Website
microsclae.pics
If you look at the code he gave, it's in app/lib/classes/class.image.php for the first 13 lines (at line 1525) and then functions.render.php at line 425.

A line starting with + means it's added and - means deleted. Lines with neither help with context.
 
  • Like
Reactions: bleached

bleached

New Member
Joined
Jul 26, 2019
Messages
4
Points
1
Thank you all for your assistance and patience! I plugged the code in as instructed, and it is now working beautifully. Exactly what I was hoping for. Thanks again!

PM me your paypal address and I'll send you a small tip as a token of my appreciation. You guys rock. (I'm sure I'll have more customization requests in the near future)
 

Dax

Core license
License owner
Joined
Mar 19, 2016
Messages
10
Points
53
No need for the paypal thing.