Просмотр файла down/ffmpeg.php

Размер файла: 963B
<?php
require_once('../lib/inc/fnc.php');
require_once('../lib/inc/db.php');
require_once('../sys/system.php');
require_once('inc/conf.php');


$W = $conf[0]['video_w'];
$H = $conf[0]['video_h'];
$id = (int)$_GET['id'];


$file_info = mysql_fetch_array(mysql_query("SELECT `name`,`size`,`path` FROM `d_file` WHERE `id`='$id'"));
$pic = $file_info['path'];
$size=$file_info['size'];
$fname=$file_info['name'];
$name = 'cache/'.$size.$fname.'.gif';
$location = $home.'down/'.$name;


if(file_exists($name)){
header('Location: '.$location, true, 301);
exit;
}
$mov = &new ffmpeg_movie(BASE.'down/life/'.$pic);
$wn = $mov->GetFrameWidth();
$hn = $mov->GetFrameHeight();

$frame = $mov->getFrame(20);

$gd = $frame->toGDImage();


$new = imageCreateTrueColor($W, $H);
imageCopyResampled($new, $gd, 0, 0, 0, 0, $W, $H, $wn, $hn);
imageGif($new,BASE.'down/cache/'.$size.$fname.'.gif');

header('Location: '.$location, true, 301);
?>