It can be avoided by changing some linux settings, but strongly suggested is to change thumbs storage structure against any future complication.
Unfortunately changing thumbs storage structure is not so simple in AVS script. It requires many changes in AVS php functions and templates. Also very important is storage structure. It should be simple, easy to understand for webmaster, also easy to implement on templates.
Here's our solution that forces AVS system to create next an next subdirectory for each 1 thousand videos thumb dir. We thought of this solution, so it could allow for really minimum change in thumb image src path.
Before you try it you should consider some important things:
1. Are you enough PHP/Smarty experienced to make changes described below?
2. ALWAYS backup php or tpl file before you edit it.
3. ALL CHANGES YOU DO IS ON YOUR OWN RISK
Ok, let's start...
First thing to do is to create new structure for your thumb images.
Before making live new method for thumbs structure we strongly suggest not to remove or rename original "/media/videos/tmb" directory.
Instead we suggest to create new directory "tmb2" in "/media/videos/"
Next create subdirecties like "1","2","3" for each 1 thousand thumbs dirs.
Then copy each certain video thumbs directory to one of numeric directories we prepared.
Form 1 to 1000 - to thumbs directory "1"
From 1001 to 2000 - to thumbs directory "2"
From 2001 to 3000 - to thumbs directory "3"
and so on...
A script could be written to fasten copu operation, however for unexperienced people suggested is to do it manually, so it can take time...
Once all thumbs copied to new directories you can proceed with php and tpl files edition.
1. Create empty file "modifier.ceil.php"
===================================
Enter this code:
- Code: Select all
<?php
function smarty_modifier_ceil($number)
{
return ceil($number/1000);
}
?>
Save and upload to "include/smarty/libs/plugins" directory
2. File "include/function_video.php"
===================================
See the post concerning thumbs extraction function below.
3. Some siteadmin php files to change
=======================================
A -siteadmin/modules/videos/add.php
Line:
- Code: Select all
$tmb_dir = $config['BASE_DIR'].'/media/videos/tmb/'.$vid;
@mkdir($tmb_dir);
Change to:
- Code: Select all
$subdir = $tmb_dir = $config['BASE_DIR'].'/media/videos/tmb/'.ceil($vid/1000);
if(!file_exists($subdir.'/')) @mkdir($subdir);
$tmb_dir = $subdir.'/'.$vid;
@mkdir($tmb_dir);
B. -siteadmin/modules/videos/embed.php
Line:
- Code: Select all
$tmb_dir = $config['BASE_DIR'].'/media/videos/tmb/'.$vid;
@mkdir($tmb_dir);
Change:
- Code: Select all
$subdir = $tmb_dir = $config['BASE_DIR'].'/media/videos/tmb/'.ceil($vid/1000);
if(!file_exists($subdir.'/')) @mkdir($subdir);
$tmb_dir = $subdir.'/'.$vid;
@mkdir($tmb_dir);
3. Edit multiple templates where video thumb may appear.
========================================================
Wherever thumb image "src" parameter appears do like in example from "videos.tpl"
The line is:
- Code: Select all
<img src="{$relative}/media/videos/tmb/{$videos[i].VID}/{$videos[i].thumb}.jpg" ....... />
New line will be:
- Code: Select all
<img src="{$relative}/media/videos/tmb/{$videos[i].VID|ceil}/{$videos[i].thumb}.jpg" ....... />
Can you see the change?
/{$videos[i]}/ is changed to /{$videos[i]|ceil}/
Really this is minimum change, can't be easier.
Other templates I found to edit:
-------------------------------------
- index.tpl
- video.tpl (1 place)
- user_videos.tpl (1 place)
- user_playlist.tpl
- user_favorite_videos.tpl
- search_videos.tpl
And some siteadmin templates I found to edit:
-----------------------------
- videos.tpl
- videos_feature.tpl
- videos_inappropriate.tpl
- videos_flagged.tpl
Just check (user search function) every place where image "src" appears along with thumb path.
Once you have all done, you can set new thumbs directories structure.
1. Rename original directory "/media/videos/tmb" to eg. "/media/videos/tmb_old"
2. Rename directory we created "/media/videos/tmb2" to "/media/videos/tmb"
Once you check that new structure for thumbs is working correctly, you can remove "/media/videos/tmb_old" directory, but do not do it too soon.
The solution here doesn't require changes for thumbs rotation. It should rotate fine.
FINAL NOTE
I wrote this post based on what I found in AVS code. The solution is as easy as it can be, idea is surely right, however I didn't have time to test it all live enough. We do not have any AVS based website, but have really long experience in programming, especially in video scripts lately. We did hundreds jobs for AVS and Clipshare users, so we really know what we do.
If you do changes to the script and find something not working, you can try to ask us if you provide as much details as possible. But do not expect that we can come to your server and setup everything for you.
All free help is what we post on forums. All further help is not free and is a matter of our programming hourly rates and agreement between user and us.
Good luck.