Skip to content

Instantly share code, notes, and snippets.

@ugeugeHigh

ugeugeHigh/test2.php

Created Feb 10, 2019
Embed
What would you like to do?
<?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