Thursday, October 4, 2012

How to take screenshot from video in php

Here i am going to explain you how to take screenshot(thumbnail) from video in php. First Of All we need to installed ffmpeg on our server.If your server does not have this facility please contact your web hosting provider. function captureImageFromVideo($imagename,$videoname)  { $ffmpeg = '/usr/bin/ffmpeg'; //video dir $video = '/public_html/video/'.$videoname; //where to save the image $image = '/public_html/image/'.$imagename; //what time to take screenshot from...
Read More »

Wednesday, October 3, 2012

How to create zip and download

In this post I am going to explain you how to create zip file and download. We need some files on some directory which we will zipped by code. For this task we are using PHP zip library, it must enabled on your server. Here is function function zipFilesDownload($file_names,$archive_file_name,$file_path) { $zip = new ZipArchive(); //create the file and throw the error if unsuccessful if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) { ...
Read More »

Thursday, September 6, 2012

MySQL Using SUM and CASE in statement

Problems i faced in mysql query one day i was working on Race project where director can payment online and manually . I had been stored all Amount in one column "amt". take a look on below image I was want SUM of manual payment , electronic payment and total of all payment in one query.  That day i had been write following query by using Mysql SUM() function and conditional CASE statement. Here...
Read More »

Tuesday, August 7, 2012

How to install ffmpeg in xampp

Install ffmpeg for windowsStep 1 Install xampp, use latest version. After installation there should be a directory C:\xamppIn this example i use C:\xampp as default directory. Step 2Check if gd2 is installed, you can do this by using phpinfo() in you script.Step 3Download ffmpeg.exe from one of the following links:http://ffdshow.faireal.net/mirror/ffmpeg/http://arrozcru.no-ip.org/ffmpeg_buildshttp://ffdshow.faireal.net/mirror/ffmpeg/http://www.paehl.com/open_source/?Convert_Tools:FFMPEGhttp://oss.netfarm.it/mplayer-win32.php...
Read More »

Monday, July 30, 2012

How to find second highest salary in MySQL

if you have MySQL table like below image if you want to fetch second highest salary of employee following query will be useful for you. select sal from emp group by sal order by sal desc Limit 1,1 your output will be like below image if you want to fetch all employee which have second highest salary following query will be useful for you. select * from emp where sal=(select...
Read More »

Sunday, July 22, 2012

How to delete all inside folder

This function is useful to delete all inner folder of given path of folder. Lets explain in example: if you have folder which name is user_1  and user_1 have lots of folder like (my_album, my_profile,friends_photo etc.) if you want to delete folder (my_album, my_profile,friends_photo etc.) call function like belew <?php deleteDirectory($dir); // $dir = path of user_1 folder ?> function deleteDirectory($dir) { if (!file_exists($dir)) return true; if (!is_dir($dir)...
Read More »

Saturday, July 21, 2012

Date after 10 days

$your_date = '2012-07-21'; $date_after_ten_days = date("Y-m-d",strtotime(date("Y-m-d", strtotime($your_date)) . " +10 day")); echo $date_after_ten_days; //output 2012-07-...
Read More »

Tuesday, May 8, 2012

Javascript function

function emailCheck() { var email_race_0 = document.getElementById("email_race_0").value; var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(reg.test(email_race_0) == false) { alert('Invalid Email Address'); return false; } } function isAlphaOrParen(str) { return /^[a-zA-Z()]+$/.test(str); } function emty_value_space(str_value) { if(str_value=='' || !str_value.match(/[^\s]/)) {return false;}else{return true;} } function isNumeric(v)...
Read More »