The Little Guy Posted March 13, 2008 Share Posted March 13, 2008 This has been bugging me... I upload a video file other than a flv file, and it converts it to a flv fine, and makes a thumbnail fine. But, when I upload a flv file, it doesn't make the thumbnail, but it does upload the video. Create the flv file name: <?php $find = array('!','@','#','$','%','^','&','*','(',')','\\','/'); $replace = array('ex','at','pnd','dol','per','sqr','and','ask','lper','rper','bsl','fsl'); $name = str_replace($find,$replace,$_FILES["file"]["name"][$key]); #2 create new file name if($_POST['write'] == '2'){ $str = ''; for($r=0;$r<5;$r++){ $str .= rand(0,9); } $fName = $time.$str.getext($name); $typ = 1; } #1 equals overwrite else{ if(file_exists("../../tzfiles.com/users/{$_POST['uploadTo']}/$name")){ $fName = $name; $typ = 2; }else{ $fName = $name; $typ = 1; } } if(in_array($file,$video_types)&&$file!='.flv'){ $pos = strrpos($fName,'.'); $f = substr($fName,0,$pos); $flvName = $f.'.flv'; }else{ $flvName = $fName; } ?> This is the code that makes the flv file and thumbnail. <?php if(in_array($file,$video_types)){ //320x240 -ar 22050 -ab 32 -f flv -qmax 100 -s 320x240 -aspect 4:3 exec("/usr/bin/ffmpeg -s 320x240 -i '../../tzfiles.com/users/{$_POST['uploadTo']}/$fName' -s 320x240 -b 250k '../../tzfiles.com/users/{$_POST['uploadTo']}/$flvName'"); if(!file_exists("../../tzfiles.com/users/{$_POST['uploadTo']}/thumbs/videos")){ mkdir("../../tzfiles.com/users/{$_POST['uploadTo']}/thumbs/videos"); } exec("ffmpeg -i '../../tzfiles.com/users/{$_POST['uploadTo']}/$flvName' -an -ss 00:00:03 -t 00:00:01 -r 1 -y -s 120x90 '../../tzfiles.com/users/{$_POST['uploadTo']}/thumbs/videos/$f%d.jpg'"); // rename("../../tzfiles.com/users/{$_POST['uploadTo']}/thumbs/videos/".$f."1.jpg","../../tzfiles.com/users/{$_POST['uploadTo']}/thumbs/videos/$f.jpg"); if($file != '.flv'){ unlink("../../tzfiles.com/users/{$_POST['uploadTo']}/$fName"); } $fName = $flvName; $filesize = filesize("../../tzfiles.com/users/{$_POST['uploadTo']}/$fName"); } ?> Link to comment https://forums.phpfreaks.com/topic/95914-createing-a-thumbnail/ Share on other sites More sharing options...
The Little Guy Posted March 13, 2008 Author Share Posted March 13, 2008 Hehe.... Found an apostrophe.... messed it up... SOLVED Link to comment https://forums.phpfreaks.com/topic/95914-createing-a-thumbnail/#findComment-491067 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.