Related Topics


[Video CMS v4]Organize uploads by date  (Read 710 times) Print

1 B


TigerClaw  May 06, 2015, 03:25:17 PM

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!

Logged


wetvibes  May 06, 2015, 03:36:04 PM

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

Logged


Alexander  May 06, 2015, 04:25:30 PM

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
Code
$fp = ABSPATH.'/'.get_option('mediafolder')."/";

as

Code
$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:

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

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

All depends on your own strategy.

Logged

TigerClaw  May 06, 2015, 04:29:15 PM

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.

Logged


Alexander  May 06, 2015, 05:44:34 PM

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....

Logged

wetvibes  May 06, 2015, 06:24:33 PM

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

Logged


Alexander  May 06, 2015, 07:12:11 PM

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

Logged

TigerClaw  May 07, 2015, 06:28:59 PM

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

Logged


Alexander  May 07, 2015, 08:20:05 PM

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

Logged

giovanni  May 07, 2015, 08:27:55 PM

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

Logged


Alexander  May 07, 2015, 08:42:44 PM

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

http://www.phpvibe.com/forum/phpvibe-announcements/the-youtube-importer-is-being-upgraded/

Logged

TigerClaw  May 22, 2015, 03:11:16 AM

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

Logged


Alexander  May 22, 2015, 02:48:47 PM

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.

Logged