Tuesday, 17 November 2009

Smarty variable in javascript

{literal}
!---script
$(window).load(function() { var sample=’/sample.php?v={/literal}{$smarty_variable}{literal}’; });
/script---
{/literal}

Tuesday, 8 September 2009

Code to Fetch Youtube Video's Image (JS)

///
//// functionjo getScreen( url, size )
///{
///alert(url);
//alert(size);
// if(url === null){ return ""; }

// size = (size === null) ? "big" : size;
/ var vid;
// var results;

// results = url.match("[\\?&]v=([^&#]*)");

// vid = ( results === null ) ? url : results[1];

/// if(size == "small"){
/// alert("http://img.youtube.com/vi/"+vid+"/2.jpg");
// return "http://img.youtube.com/vi/"+vid+"/2.jpg";
/// }else {
/// alert("http://img.youtube.com/vi/"+vid+"/0.jpg");
/// return "http://img.youtube.com/vi/"+vid+"/0.jpg";
/// }
// }
//



///// function call /////

////onload="getScreen('http://www.youtube.com/watch?v=-4ce_C2Cako', 'small');"

Tuesday, 1 September 2009

video conversion codes - through FFMPEG

// system("/usr/bin/ffmpeg -i 1214564751.wmv -r 25 -acodec mp3 -ar 22050 -s 320x240 video.flv");

//system("ffmpeg -i 1214564751.wmv -ar 22050 1111.flv");

//system("/usr/bin/ffmpeg -i videos/12170871531204448905_64.wmv -r 25 -acodec mp3 -ar 22050 -s 320x240 -y videos/testflv.flv");

/* image converter

system("/usr/local/bin/ffmpeg -i lmtttt.flv -vcodec png -vframes 1 -an -f rawvideo -s 320×240 lmmmm.jpg");

*/

// system("/usr/local/bin/ffmpeg -i mobile.avi -r 25 -acodec mp3 -ar 22050 -s 320x240 avijo.flv");

system("/usr/local/bin/ffmpeg -i mobile.avi -ar 22050 avijo1111.flv");

system("/usr/local/bin/ffmpeg -i Penquen.mpg -ar 22050 mpgjo.flv");

system("/usr/local/bin/ffmpeg -i baby_dance.wmv -ar 22050 wmvjo.flv");

//system("/usr/bin/ffmpeg -i clock.avi -r 25 -acodec mp3 -ar 22050 -s 320x240 jo1.flv");

//exec("/usr/bin/ffmpeg -i clock.avi -r 25 -acodec mp3 -ar 22050 -s 320x240 jo2.flv");

//exec("/usr/bin/ffmpeg -i clock.avi -r 25 -acodec mp3 -ar 22050 -s 320x240 jo3.flv");

Monday, 3 August 2009

Inner Select

//// Single2:

Monday, 27 July 2009

BYTES TO OTHER FORMATS

function HumanSize($Bytes)
{
$Type=array("", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta");
$Index=0;
while($Bytes>=1024)
{
$Bytes/=1024;
$Index++;
}
return("".$Bytes." ".$Type[$Index]."bytes");
}

echo HumanSize(33535356576765656766656445456);
?>

To get the alphabets in Loop function

for ($i = 65; $i <= 90; $i++)
{

echo $drive = chr($i);

}

OUTPUT:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

To get the disk space of your system using php

for ($i = 67; $i <= 90; $i++)
{
$drive = chr($i);
if (
is_dir($drive.':'))
{
$freespace = disk_free_space($drive.':');
$total_space = disk_total_space($drive.':');
$percentage_free = $freespace ? round($freespace / $total_space, 2) * 100 : 0;
echo
$drive.': '.to_readble_size($freespace).' / '.to_readble_size($total_space).' ['.$percentage_free.'%]
'
;
}
}

function
to_readble_size($size)
{
switch (
true)
{
case (
$size > 1000000000000):
$size /= 1000000000000;
$suffix = 'TB';
break;
case (
$size > 1000000000):
$size /= 1000000000;
$suffix = 'GB';
break;
case (
$size > 1000000):
$size /= 1000000;
$suffix = 'MB';
break;
case (
$size > 1000):
$size /= 1000;
$suffix = 'KB';
break;
default:
$suffix = 'B';
}
return
round($size, 2).$suffix;
}
?>