• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] Organize uploads by date

Started by TigerClaw,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TigerClawTopic starter

Hello,

currently PHPVibe store all the local files in the root of these directories:

media
media/thumbs
uploads
rawmedia

On my servers configuration this is a serious performance hit and I would like to know how I can divide the uploads by year-month-day.
So file uploaded on 2015-07-05 will be uploaded under

media/2015-07-05
media/thumbs/2015-07-05
uploads/2015-07-05
rawmedia/2015-07-05

Thank you!
  •  

wetvibes

this will be a great feature and could save alot of server load.
  •  

PHPVibe A.

Quote from: wetvibes on
this will be a great feature and could save alot of server load.

How come?

On my website is organised by /media/owner-id/, but you'll just have to modify the videocron.php, upload(-ffmpeg/-mp3).php and /lib/class.providers.php  according to your needs.
However, if you have videos stored, it gets tricky.

For example you can use
$fp = ABSPATH.'/'.get_option('mediafolder')."/";


as

$fp = ABSPATH.'/'.get_option('mediafolder')."/".user_id()."/";


Sure, you can change the user_id() to a date combination ( http://php.net/manual/en/function.date.php ) and when querying in class-providers to modify the structure, or just on insert:

$source= 'localfile/'.$cron->token.'.mp4';

to

$source= 'localfile/'.user_id().'/'.$cron->token.'.mp4';


All depends on your own strategy.

TigerClawTopic starter

In a clustered environment recursive operation over big directories is a serious performance hit. You don't notice it when they are small but when they are 10k+ it starts to lag.
it happens also with local file systems but it it not so bad.
  •  

PHPVibe A.

The problem to add this by default relies in the fact that folder creation and permission settings is closed/restricted on most hostings, and we will have an high rate of chargebacks, so we try to keep away from features like this...we are forced to think global since we live on what we make....

wetvibes

Alex, the mods you provided above will affect the site is it already has videos uploaded?
  •  

PHPVibe A.

Those are not mods, just example plan, I'm not sure what errors it will face or inconveniences in practice.

It's a plan we've used for http://fashionjunkie.ro/ (No, it's not the default PHPVibe).

As you can see it stores it in a folder which is named with the user id and retrieves it using the owner id.

o.php?src=media/53/5371c050c82780b98293ab5cd2df5a2d09e9e2aacd27f.jpg&w=284&q=100

TigerClawTopic starter

I managed to have the videos under my custom dir structure but the thumbs are still saved under /media/thumbs. Where is the code that take care of the thumbs for local uploads? Doesn't seem to be in upload.php.

Thank you
  •  

PHPVibe A.

depends, the ones generated with ffmpeg are in videocron.php, else in the sharing files at com/com_*

giovanni

i get this on  title

https://youtube.com/devicesupport
................................................................
I get this on description

https://youtube.com/devicesupport
http://m.youtube.com

also image https://youtube.com/devicesupport
embed  video shows but not image
on moderator and when I embedd as a user it started today can someone help me
  •  

PHPVibe A.


TigerClawTopic starter

Could we please get an option in the config panel to activate the uploads by userID or Date? I think it would be useful for everybody
  •  

PHPVibe A.

Quote from: TigerClaw on
Could we please get an option in the config panel to activate the uploads by userID or Date? I think it would be useful for everybody

I'm not sure what you mean.

Similar topics (7)