Displaying Video Description

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mo
Forum Newbie
Posts: 21
Joined: Thu Nov 06, 2003 7:21 am

Displaying Video Description

Post by Mo »

Using PHP I am scanning a directory for .AVI files then listing the file names and sizes as links to play them. I do not want to display the file names, but rather a description of the file. I do not want to use a database. Can this be done? I know that an image stores a description (by right-clicking and viewing the images properties).
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

The best way is to store a .txt file with the .avi and give it the same name. That way you can put the description of the movie in the text file and load it up into PHP, ie if the movie is called Boobs.avi then create a text file called Boobs.txt
Mo
Forum Newbie
Posts: 21
Joined: Thu Nov 06, 2003 7:21 am

Post by Mo »

Yes, I think that is a good way. I use one text file for all of my videos, correct?
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Nah, with that way each AVI should have its own TXT.

If the information isn't going to be changing much, why not use [php_man]switch[/php_man]() and set a $description variable for each of the filenames. Unless of course embedding the data within the code is a bad solution for you. Sometimes I do it this way, sometimes I use a DB or TXT/HTML file.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

If going for the multible textfiles solution;
To ease up on the handling of this a text file with the identical name (except the .avi/.txt extension of course) is one idea.

A very simple but understandable example:

Code: Select all

$filename = 'my_name_is_foo.avi';
 $text = substr($filename,-3); // my_name_is_foo
 include($text.'.txt'); // my_name_is_foo.txt holding the description
Post Reply