• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

Auto-animate GIF thumbnails

bleached

Chevereto Noob
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!
 
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.
 
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!
 
I think this is what you'll need:

[CODE title="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;[/CODE]
 
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.
 
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.
 
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)
 
I think this is what you'll need:
[CODE title="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;[/CODE]
This code no work for me. Gif thumbs on the main page still OFF, but full image work perfectly. The last chevereto 3.13.4 :(
 
Back
Top