I found a way to play animation of GIF images uploaded

dobbydobby / 2018-10-06 00:18:26   

I've thought that GIF is de-animated when uploading, so that I have to fix the entire uploading algorithm. However, I just found out that the raw gif files with animation have been also uploaded in same directories, with few filename changes.
So, I made it work by changing src attribute of img tag with some javascript. And here's how:

** 1st step:
in theese 3 files below:
ndxzsite/default/index.php
ndxzsite/default/media.php
ndxzsite/mobile/index.php

copy and paste this script tag right above the < / body>


function wakegif(){
var imgtags = $('img');
for(var i = 0; i < imgtags.length; i++ ){
var it = $(imgtags[i]);
var url = it.attr('src');
var newurl = url.replace(/gimgs\/\d+\_/,'gimgs/');
it.attr('src',newurl);
}
};
$(wakegif());

** 2nd step:
in this file below:
ndxzsite/js/ndxzbox.js

in the line between "var lheight;" and "$(document).ready(function()",
which is 17th line in my code; copy and paste this code below:

function wakegif(){
var imgtags = $('img');
for(var i = 0; i < imgtags.length; i++ ){
var it = $(imgtags[i]);
var url = it.attr('src');
var newurl = url.replace(/gimgs\/\d+\_/,'gimgs/');
it.attr('src',newurl);
}
};

and in the same file, which is "jquery.ndxzbox.js"
find the code "processing = false;" and paste this following code in the next line of that

wakegif();

so, it should looks like:
(some other codes)....
...
processing = false;
wakegif();
...
....(some other codes)

in the jquery,ndxzbox.js file, there's five "processing = false;" code. So you have to find and add the code five time in each places.

** step3: That's All!
I hope my instruction is not that bad so you can get some help. :0

dobbydobby / 2018-10-06 00:26:30   

Oh I almost forgot!
You need to import jQuery in theese two file below

ndxzsite/default/index.php
ndxzsite/default/media.php

May be you can find good instructions about how to import jQuery by searching from google, if you don't know how.

stufferino / 2018-10-26 21:37:01   

Doesn't seem to work. Any idea why?

dobbydobby / 2018-11-05 13:15:54   

Can you copy and paste the error message in the console, if you have it? It is shown in the console screen of developer tool

developers.google.com/web/tools/…

Carnbot / 2018-11-13 00:20:03   

I didn't get this to work either and pretty sure I did everything correctly. but will have another go and post back any messages.

Vaska A / 2018-11-13 08:34:54   

The upgrade that is coming works with animated gifts (and retina image creation). You can read the news for more information...

Carnbot / 2018-11-13 10:24:17   

Great news, thanks Vaska :)

This thread has been closed, thank you.