jasonc Posted October 20, 2010 Share Posted October 20, 2010 edited: please note all wmv files are not more than 10 or 20 seconds long. also their size is no more than 500kb. I have this following code that works for photos, but wish to alter this slightly so it will work for video files (wmv) getFtpImage.php <? header('Content-Type: image/jpg'); $imgdir = '/home/mysite/ftpfolder'; readfile($imgdir . '/' . $_GET['file']); ?> index.php $imgdir = '/home/mysite/ftpfolder'; // the directory, where your images are stored $allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show $dimg = opendir($imgdir); while($imgfile = readdir($dimg)) { if(in_array(strtolower(substr($imgfile,-3)),$allowed_types)) { $a_img[] = $imgfile; sort($a_img); reset ($a_img); } } $totimg = count($a_img); // total image number for($x=0; $x < $totimg; $x++) { $size = getimagesize($imgdir.'/'.$a_img[$x]); // do whatever $halfwidth = ceil($size[0]/2); $halfheight = ceil($size[1]/2); ?><img src="getFtpImage.php?file=<? echo ($a_img[$x]); ?>" height="180"><? // echo 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />'; } i have the images show to fill the screen and wish for the video page to do the same and with the videos you click the [play] in the center of the video image to play it like most videos play, not like the flash. Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/ Share on other sites More sharing options...
trq Posted October 21, 2010 Share Posted October 21, 2010 So what is your question? You can't play movies directly within html (yet). You need a player. Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/#findComment-1124689 Share on other sites More sharing options...
jasonc Posted October 21, 2010 Author Share Posted October 21, 2010 i have a load of photos and videos and the photos script (above) works and show the images, i am using the getFtpImage.php file to get the content of the image as it is in a folder outside of the public_html folder. i also have WMV files in this outside ftpfolder and wish to allow the user to click a link to play the file in their browser. i would normally use the embed method but as it is not an image that can be got using the getFtpImage.php file i need another method to allow the WMV to play. Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/#findComment-1124712 Share on other sites More sharing options...
trq Posted October 21, 2010 Share Posted October 21, 2010 Now I'm with you. You need to rewrite another script (almost a copy of getFtpImage.php) that sets the content type to video/x-ms-wmv (you could use the same script with an if statement that determines the types by file extension. From there, you just use the normal embed method. I have to say, wmv files are not a particularly 'web friendly' format. Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/#findComment-1124714 Share on other sites More sharing options...
jasonc Posted October 21, 2010 Author Share Posted October 21, 2010 ok i did that using you helpful piece of info about the file type text. only problem is that i get a down load box when i click the link, is there an embed or method i can use that will show the thumb nail of the first image? a bit like flash? <? header('Content-type: video/x-ms-wmv'); $imgdir = '/home/mysite/ftpfolder'; readfile($imgdir . '/' . $file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/#findComment-1124782 Share on other sites More sharing options...
trq Posted October 21, 2010 Share Posted October 21, 2010 As I said. You need a player. Quote Link to comment https://forums.phpfreaks.com/topic/216409-how-to-stream-video-via-ftp-folder-not-accessable-to-public/#findComment-1124787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.