Listing 1. movies.sql
DROP TABLE IF EXISTS movies;
CREATE TABLE movies (
movieId INTEGER NOT NULL AUTO_INCREMENT,
title VARCHAR( 255 ),
source VARCHAR( 255 ),
thumb VARCHAR( 255 ),
width INTEGER,
height INTEGER,
PRIMARY KEY( movieId )
);
mysql movies < movies.sql
Listing 2. addmovie.htmlTitle
Movie
Listing 3. upload.php&1";
$fh = popen( $cmd, "r" );
while( fgets( $fh ) ) { }
pclose( $fh );
}
function getthumbnail( $in, $out )
{
unlink( $out );
$cmd = "ffmpeg -i $in -pix_fmt rgb24 -vframes 1 -s 300x200 $out 2>&1";
$fh = popen( $cmd, "r" );
while( fgets( $fh ) ) { }
pclose( $fh );
}
function flv_import( $upfile, $fname, $title )
{
$fname = preg_replace( '/\..*$/', '', basename( $fname ) );
$flvpath = "$fname.flv";
$thumbpath = "$fname.gif";
converttoflv( $upfile, "movies\\$flvpath" );
getthumbnail( $upfile, "movies\\$thumbpath" );
$dsn = 'mysql://root@localhost/movies';
$db =& DB::connect( $dsn );
if ( PEAR::isError( $db ) ) { die($db->getMessage()); }
$sth = $db->prepare( 'INSERT INTO movies VALUES ( 0, ?, ?, ?, ?, ? )' );
$db->execute( $sth, array( $title, $flvpath, $thumbpath, 300, 200 ) );
}
flv_import( $_FILES['movie']['tmp_name'], $_FILES['movie']['name'], $_POST['title'] );
?>
File sucessfully uploaded
http://www.bkjia.com/PHPjc/632019.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632019.htmlTechArticleListing 1. movies.sql DROP TABLE IF EXISTS movies;CREATE TABLE movies ( movieId INTEGER NOT NULL AUTO_INCREMENT, title VARCHAR( 255 ), source VARCHAR( 255 ), thumb VARCHAR( 255 ),...