Skip to main content

Posts

Embed Youtube video inside Jwplayer - example

<embed height="300" width="470" flashvars="file=http://www.youtube.com/watch?v=ZSn51xYQ3rw&autostart=true&stretching=fill&image=http://www.example.com/hwdvideos/thumbs/l_aweithwanybbb3.jpg" wmode="opaque" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#000000" name="player" id="player" style="" src="mediaplayer.swf" type="application/x-shockwave-flash"> Note: You need to have 'yt.swf' (file related to youtube) along side 'mediaplayer.swf' to get this code working.

php get files in a folder

<?php $results = array();     $directory = 'my_folder/files';         // create a handler for the directory     $handler = opendir($directory);     // open directory and walk through the filenames     while ($file = readdir($handler)) {       // if file isn't this directory or its parent, add it to the results       if ($file != "." && $file != "..") {         $results[] = $file;       }     }     // tidy up: close the handler     closedir($handler);         print_r($results); ?>

ffmpeg convert to flv file

Using ffmpeg.exe, we can convert a media file into flv format, with a little code as below: <?php exec('ffmpeg -i abc.mpg abc.flv'); ?> The above code converts the "abc.mpg" file into "abc.flv" file. Note that the "ffmpeg.exe" file must be present in the directory where this code is run.

mysql enable remote root access

Example : Enable remote root access to ip address: 192.168.3.177 mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.3.177' IDENTIFIED BY '' WITH GRANT OPTION; mysql > FLUSH PRIVILEGES; This setting also allows us to connect to mysql in our php code, with the host set to ip address, 192.168.3.177 : mysql_connect("192.168.3.177","root","");