Skip to content

Instantly share code, notes, and snippets.

@ugeugeHigh
Created February 10, 2019 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugeugeHigh/5c1737947790a292065e74ceff0cb53a to your computer and use it in GitHub Desktop.
Save ugeugeHigh/5c1737947790a292065e74ceff0cb53a to your computer and use it in GitHub Desktop.
<?php
ini_set('display_errors', 1);
$file = $_FILES['gif'];
$ext = substr($file['name'], -4);
$tempfile = $file['tmp_name'];//一時ファイルの名前を取得
//HTTP POST でアップロードされたファイルかどうか調べる
if(is_uploaded_file($tempfile)) {
if($ext=='.mov'||$ext=='MOV'||$ext=='mp4'||$ext=='MP4') {
$filePath = 'tmp/' .$file['name'];
move_uploaded_file($file['tmp_name'], $filePath);
//print('<img src="'.$filePath.'" />');
exec('/usr/local/bin/ffmpeg -i '. $filePath .' tmp/new.gif');
print('<img src=tmp/new.gif>');
} else {
print("error");
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment