Extracting video dimensions from an FLV file?

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
Wolf_22
Forum Contributor
Posts: 159
Joined: Fri Dec 26, 2008 9:43 pm

Extracting video dimensions from an FLV file?

Post by Wolf_22 »

Without using the getid3 library, can this be accomplished with "getimagesize()"?

In my code, I have 2 conditions:

Code: Select all

if(!getimagesize("movies/{$file}")){
    $info = 'Someone call the police!';
    $width = $info;
    $height = $info;
}else{
    $info = getimagesize("movies/{$file}");
    $width = $info[0];
    $height = $info[1];
}
I'm ignorantly unable to understand why it keeps hitting the first IF. Anyone know? I know for a fact that $file is the name of the file (I've checked using echo--it's the correct name). It seems as if the script is unable to look in the sub-directory "movies."
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Re: Extracting video dimensions from an FLV file?

Post by Skara »

php.net wrote:The getimagesize() function will determine the size of any given image file...
An flv is not an image file.

I think this will get you what you want: http://getid3.sourceforge.net/
Wolf_22
Forum Contributor
Posts: 159
Joined: Fri Dec 26, 2008 9:43 pm

Re: Extracting video dimensions from an FLV file?

Post by Wolf_22 »

Yep, it would appear you're right. I was just trying to avoid using that thing because it seems huge.

I'll give it a go, though.
Post Reply