Saturday, December 15, 2007

WHY PHP 5??????

PHP 4 has served the web developer community for seven years now, and served it well. However, it also shows its age. Most of PHP 4's shortcomings have been addressed by PHP 5, released three years ago, but the transition from PHP 4 to PHP 5 has been slow for a number of reasons.

PHP developers cannot leverage PHP 5's full potential without dropping support for PHP 4, but PHP 4 is still installed on a majority of shared web hosts and users would then be forced to switch to a different application. Web hosts cannot upgrade their servers to PHP 5 without making it impossible for their users to run PHP 4-targeted web apps, and have no incentive to go to the effort of testing and deploying PHP 5 while most web apps are still compatible with PHP 4 and the PHP development team still provides maintenance support for PHP 4. The PHP development team, of course, can't drop maintenance support for PHP 4 while most web hosts still run PHP 4.

It is a dangerous cycle, and one that needs to be broken. The PHP developer community has decided that it is indeed now time to move forward, together. Therefore, the listed software projects have all agreed that effective February 5th, 2008, any new feature releases will have a minimum version requirement of at least PHP 5.2.0. Furthermore, the listed web hosts have agreed that effective February 5th, 2008, they will include PHP 5.2 (or a more recent version) in their service offer.

It is our belief that this will provide web hosts reason to upgrade and the PHP development team the ability to retire PHP 4 and focus efforts on PHP 5 and the forthcoming PHP 6, all without penalizing any existing project for being "first out of the gate".

FFMPEG Integration with PHP

conn.php
=======


include("function.php");

$config['BASE_DIR'] = '/home/vhosts/ena/biztech';

$config['BASE_URL'] = 'http://ena.pingworx.com/biztech';

$config['tmpimgpath'] = '/home/vhosts/ena/biztech/temp';

$config['tmpimgpath2'] = '/home/vhosts/ena/biztech/temp';

$config['ffmpeg'] = '/usr/local/bin/ffmpeg';

$config['mplayer'] = '/usr/local/bin/mplayer';

$config['mencoder'] = '/usr/local/bin/mencoder';

$config['metainject'] = '/usr/local/bin/flvtool2';



$config['guest_limite'] = 65535;



//$config['CONF_FILE'] = $config[BASE_DIR].'/include/conf.ini';

$config['IMG_DIR'] = $config[BASE_DIR].'/images';

$config['IMG_URL'] = $config[BASE_URL].'/images';

$config['VDO_DIR'] = $config[BASE_DIR].'/video';

$config['VDO_URL'] = $config[BASE_URL].'/video';

$config['ADO_DIR'] = $config[BASE_DIR].'/audio';

$config['ADO_URL'] = $config[BASE_URL].'/audio';

$config['FLVDO_DIR'] = $config[BASE_DIR].'/flvideo';

$config['FLVDO_URL'] = $config[BASE_URL].'/flvideo';

$config['TMB_DIR'] = $config[BASE_DIR].'/thumb';

$config['TMB_URL'] = $config[BASE_URL].'/thumb';

$config['baseurl'] = $config['BASE_URL'];

$config['basedir'] = $config['BASE_DIR'];

$config['vdodir'] = $config['VDO_DIR'];

$config['vdourl'] = $config['VDO_URL'];

$config['audiodir'] = $config['ADO_DIR'];

$config['audiourl'] = $config['ADO_URL'];

$config['flvdodir'] = $config['FLVDO_DIR'];

$config['flvdourl'] = $config['FLVDO_URL'];

$config['imgurl'] = $config['IMG_URL'];

$config['imgpath'] = $config['IMG_DIR'];

$config['tmbdir'] = $config['TMB_DIR'];

$config['tmburl'] = $config['TMB_URL'];

$config['img_max_width'] = 110;

$config['img_max_height'] = 90;
?>

upload.php
========

include("conn.php");
ob_flush();
ini_set("display_errors", "on");
ini_set("display_startup_errors", "on");
ini_set("set_time_limit", "0");
ini_set("memory_limit", "50M");
ini_set("upload_max_filesize", "10MB");

if(isset($_POST["Submit"]))
{
$vido="test";
if($_FILES[$vido]['tmp_name']!="")
{
$p=$_FILES[$vido]['name'];
$pos=strrpos($p,".");
$ph=strtolower(substr($p,$pos+1,strlen($p)-$pos));

$space = round($_FILES[$vido]['size']/(1024*1024));

$err = "";
if(($ph!="mpg" && $ph!="avi" && $ph!="mpeg" && $ph!="wmv" && $ph!="rm" && $ph!="dat" && $ph!="3gp" && $ph!="mp4" && $ph!="asf" && $ph!="mpeg4" && $ph!="divx" && $ph!="xvid" && $ph!="mov" && $ph!="flv"))
{
$err="Invalid Video Format.";
}
}

if($err=="")
{
$vid="123";
//$vdoname=rand().".".$ph;
$vdoname = "final_1".".$ph";
$fileup="test";

if(isset($_FILES[$fileup]['tmp_name']) && is_uploaded_file($_FILES[$fileup]['tmp_name']))
{
$ff = $config['vdodir']."/".$vdoname;

if(move_uploaded_file($_FILES[$fileup]['tmp_name'], $ff))
{
if($ph == "mov")
{
exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/video/final_1.mov -f flv -acodec mp3 -b 300 -r 29.97 -s 320x240 -an /home/vhosts/ena/biztech/flvideo/output_success_2.flv");
}
else
{
exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/video/final.mov -f flv -acodec mp3 -vcodec flv -ab 56 -ar 22050 -r 15 -s 320x240 -qmin 4 -qmax 10 /home/vhosts/ena/biztech/flvideo/output_final.flv");
}

exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/flvideo/output_success_2.flv -s 94x58 -ss 2 -vframes 1 -f mjpeg /home/vhosts/ena/biztech/thumb/flv_final.jpg");

}
}
}
}
?>


<form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
Upload Video File :

<input type="file" name="test" id="test">

</form>

Friday, September 21, 2007

Why PHP 5.2

PHP 4 has served the web developer community for seven years now, and served it well. However, it also shows its age. Most of PHP 4's shortcomings have been addressed by PHP 5, released three years ago, but the transition from PHP 4 to PHP 5 has been slow for a number of reasons.

The PHP developer community has decided that it is indeed now time to move forward, together. Therefore, the listed software projects have all agreed that effective February 5th, 2008, any new feature releases will have a minimum version requirement of at least PHP 5.2.0. Furthermore, the listed web hosts have agreed that effective February 5th, 2008, they will include PHP 5.2 (or a more recent version) in their service offer.

It is our belief that this will provide web hosts reason to upgrade and the PHP development team the ability to retire PHP 4 and focus efforts on PHP 5 and the forthcoming PHP 6, all without penalizing any existing project for being "first out of the gate".

Wednesday, September 12, 2007

Interesting in PHP

While digging through the GD section of the online PHP manual I noticed two new entries on the function list that immediately caught my eye: imagegrabscreen() and imagegrabwindow(). Upon further investigation both of these commands can be used to take screen shots of the desktop of your server, or any applications window (such as a web browser).Both commands are listed as being "Windows only" and also possibly only in CVS, but I found both of them are in the 5.2.3 standard release and compile without error. However at the moment neither appear to actually do anything other than return fully black images. The grabscreen command did indeed produce a PNG file exactly the same dimensions as my server, it just wasn't populated with anything. The grabwindow command didn't fare so well, and in attempting to launch and grab IEs current session my script just timed out. This could possibly be a simple COM issue, or perhaps the command just doesn't work properly yet.Eitherway they are both quite interesting additions to the GD section, and while Windows only I could still think of a few nice uses for them in an admin capacity (certainly of limited use on a public web site). For example if your Windows anti-virus software doesn't have command-line access to its interface, you could schedule a window grab to run each night that launched your AV and grabbed the last updated time, so you could see if it had updated itself overnight. Alternatively you could grab browser windows ala Browsercam. Or perhaps screen shots from a package like TreeSize Pro.I'm not so sure about the use of grabbing the entire server desktop, but I'm sure someone will come up with something. If you've managed to get either of these two functions to work then please comment about it.

Jquery - ThickBox 3

ThickBox is a webpage UI dialog widget written in JavaScript on top of the jQuery library. Its function is to show a single image, multiple images, inline content, iframed content, or content served through AJAX in a hybrid modal.

Features:
ThickBox was built using the super lightweight jQuery library. Compressed, the jQuery library is 20k, uncompressed it's 58k.
The ThickBox JavaScript code and CSS file only add an additional 15k (only 10k by using the thickbox-compressed.js) on top of the jQuery code. The CSS file could additionally be compressed if need be.
ThickBox will resize images that are bigger than the browser window.
ThickBox offers versatility (images, iframed content, inline content, and AJAX content).
ThickBox will hide form elements in Windows IE 6.
ThickBox will remain centered in the window even when the user scrolls the page or changes the size of the browser window. Clicking an image, the overlay, or close link will remove ThickBox.
Due to the ThickBox creator's view that transitions should be tailored by individual authors, ThickBox windows do not implement fancy transitions. Feel free to add them as you see fit. Is this a feature? Well, some might say it is.
ThickBox can be invoked from a link element, input element (typically a button), and the area element (image maps).

About Trac 0.10

Trac is a web-based software project management and bug/issue tracking system emphasizing ease of use and low ceremony. It provides an integrated Wiki, an interface to version control systems, and a number convenient ways to stay on top of events and changes within a project.
Trac is distributed under the modified BSD License. The complete text of the license can be found
online as well as in the COPYING file included in the distribution.
Please visit the Trac open source project at http://trac.edgewall.org/.
Copyright © 2003-2006
Edgewall Software