Showing posts with label interest. Show all posts
Showing posts with label interest. Show all posts

Saturday, 8 November 2014

jQuery Animated Number Counter From Zero To Value - Javascript Animation

JQuery is powerful Library of JavaScript , Which makes the Web Development more Faster comparing plain JavaScript and completely useful for Beginners for building such application in minutes with lot of Functions in single line.And most powerful feature is JQuery Ajax which makes the users to relaxful usage of web app without page reloading and easy for developers to work with callbacks.Jquery is also famous for it's Animation and making app more amazing and pleasing with speed, fade etc..
There are also lot of library which are built upon JQuery as Library,such as Bootstrap and so on.




Install : Demo & Download


You must need Jquery.js library use just cdn from google.


<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


Jquery:

Using animate function JQuery we could perform this animation,here is the actual Documentation

  • first argument is CSS property ,which we would generally used to animate.
  • second argumet as option
option : 

  1. duration  : amount of time in milliseconds for the animation occurance
  2. easing  : easing function for transition 
  3. step : This function provides an opportunity to modify the Tween object to change the value of the property before it is set.

Logic css with Javascript :

We get the count span counter CSS property starting from zero within a for each loop in jquery and setting the Counter as text by CSS property inside animation function and next comes option which has SWING as transition and then with duration and finally comes step option which is used to once again change the value before set and rounded off with math.ceil function.

Code and Demo :

Demo might load slow.have a look at demo hosted +codepen.ReRun the Code to see the counter changes!

$('.Count').each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).text()
}, {
duration: 4000,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});
});
See the Pen FatiB by s.shivasurya (@shivasurya) on CodePen.


Hope You have Enjoyed this post.Since it was cool one actually showing up in most of the modern websites , which made me to search and compile to perform this animated counter.and a reader too requested via me in Facebook to do with JQuery.

For Errors/Comments/Bugs/Hugs mail me s.shivasurya@gmail.com or connect with me in Facebook/Twitter you can raise your exceptions/messages!
share is care.

Friday, 18 July 2014

Import Contacts and Invite New Contacts By Email From Gmail Contacts API - Inspired By Linkedin,Twitter Mail Importer

Inviting by E-Mail is an excellent way for asking new users to try our sites,Which is actually sent by their friends or contacts in Address Book.As Like as LinkedIn,Twitter Gets your Email address especially Gmail and Access all your contacts and Matches with Their Email Database and shows their existing users to follow(connect) and invite New users to try their respective sites.It means enjoying the site with their friends(Especially Twitter does this).Even i too joined LinkedIn and Twitter because of Invitation mail from my friends in Gmail via Twitter,LinkedIn.


Import Contacts and Invite New Contacts By Email From Gmail Contacts API - Inspired By Linkedin,Twitter Importer











Reference :  
 |  

Script Structure :
  • index.php [ Main Html markup and other scripts ]
  • mail.php   [ Send Mail with Loop for Users ]
  • invite.js    [ javascript file handling JSON data append and processing Gmail Contacts API ] 
  • process.php [ Compare exisiting users and new users responding as JSON format to frontend ]

Scope : 

This is simple add-on Application for websites having Email users database.It is similar to Twitter,Linked Contact Importer where they get API access and fetch email from corresponding service and filter them accordingly as existing users and New users.and giving some options such as Follow or Connect and Inviting by Emails.

Javascript API for Gmail Contacts Import :

Gmail API Contacts let you to Read,Update,Create Contacts in Gmail.Core part of the Contacts API below Here.

Installation and Initialization:

check here how to get those keys 
 var clientId = 'Your Client ID here';
 var apiKey = 'Your api key here';
 var scopes = 'https://www.google.com/m8/feeds';

with this we are going to add Javascript plugin Jquery,Client.js from google



<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script src="https://apis.google.com/js/client.js"></script>


Javascript API to get Contact List as JSON data :

Check my Last post to Authorize a Google User and access their API - Click Here

$.get("https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=" + authResult.access_token + "&max-results=700&v=3.0",
      function(response){
if(response.feed.entry.length > 0){
         //Handle Response
       console.log(response);
         var email= [];
console.log(response.feed.entry.length);
        for ( var i= 0 ; i < response.feed.entry.length ; i++)
    {  console.log(i);
          if(response.feed.entry[i].gd$phoneNumber)
           { continue; }
else{
      email[i]= response.feed.entry[i].gd$email[0].address;
      console.log(email[i]); }
 });

Posting the Javascript email array to proccess.php via ajax to filter new users and existing users.


$.post("process.php", { email: email },
    function(Result){
     //use the results to append to show the existing users to new users.
});


process.php


process.php just filter incoming list JSON contact email to existing email database.filter them as new users as object in json ,and existing users with their prof pic we are making another object in JSON.with header JSON/Application we are just encoding output via ajax to index.php

Download the Demo files try in Localhost ,I have added Mailing code via ajax too.If you can Find any error in Javascript (invite.js) just check the console and report error as comments/ or mail me s.shivasurya@gmail.com

Thursday, 29 May 2014

Working with impress.js to create presentations using HTML & CSS3 - impress.js

Impress.js was awesome plugin to create awesome presentation because it uses HTML and CSS3 to animate and make the presentation still more lively for users.at the sametime the Author of impress.js warns about the usage of the presentation will be nice only if it is interesting and it's not suitable for the official meets presentations.however it is easy to set up the plugin environment and start our presentation slides.I hope it works only on modern browsers.i have already used Fathom.js but it was regular for official purpose but this one is quite interesting to display interesting streams.
preview img from presentation slide impress.js
  


Browser compatibility: 

Currently impress.js works fine in latest Chrome/Chromium browser, Safari 5.1 and Firefox 10. With addition of some HTML5 polyfills (see below for details) it should work in Internet Explorer 10 (currently available as Developers Preview). It doesn't work in Opera, as it doesn't support CSS 3D transforms.As a presentation tool it was not developed with mobile browsers in mind, but some tablets are good enough to run it, so it should work quite well on iPad (iOS 5, or iOS 4 with HTML5 polyfills) and Blackberry Playbook.


Installation:

just like other javascript just include both impress.js and demo-impress.js in your html file in between <head></head> tags.get the orginal source from here.



<link href="/demo-css.css" rel="stylesheet" /> 
<script src="/impress.js" ></script>


Usage :

Lets start with normal Html tags below

<html lang="en">
    <head>
        <meta charset="utf-8" />
           <!-- your CSS and JS files can be included here. --> 
</head>

now lets dive into slides where i have made them in to div tags and mentioned them with classes and ID's.

check browser issues:

before that we must check the browser support if it supports then we could proceed normally! or else we must highlight by showing them Error message and try in latest browsers.

<div id="impress" class="impress-not-supported">

    <div class="fallback-message"> <!-- this fallback message shows when issues exist -->
        <p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p>
        <p>For the best experience please use the latest <b>Chrome</b> or <b>Safari</b> browser. Firefox 10 (to be released soon) will also handle it.</p>
    </div> 

  <!-- your slides div can go here -->


</div> <!-- end of div class="impress-not-supported" -->


slides as div tag : 

before directly creating tags,just imagine a graph sheet in which you reference with X,Y,Z axis in which our div slides are going to be placed.our javascript plugin takes the value from div and moves around accordingly with CSS3.
it is mandatory to use Class step in each of our div slides.and you can mention other options if you want.

General Approach of Div slide:

<div class="step" data-x="Preferred_value" data-y="Preferred_value" data-z="Preferred_value" data-rotate="Preferred_option" data-scale="Preferred_option">

  <!-- here you could use your own style of HTML coding for contents --> 

</div>


Example for Div slide:
options:
data-x : which moves along x-axis slide
data-y : which moves along y-axis slide
data-z : which moves along z-axis slide
data-rotate : which rotates around and reach your slide normally
data-scale : which scales above the slide(zoom level)

<div class="step" data-x="200" data-y="200" data-z="100" data-rotate="45" data-scale="5">

  <!-- here you could use your own style of HTML coding for contents --> 
<p>welcome to i-visionblog.com</p>
<p>i love to create and share my ideas through my blog </p>
<p>i love to create web/mobile apps as a hobby and my interest is to work with Bigdata and analytics</p>

</div>


additional to this we could add some extra effects 3D with id="its-in-3d" and giving option to rotate in their axis 
data-rotate-x & data-rotate-y & data-rotate-z : which rotates when sliding on their axis corresponding, can be a 3D view.however it is simple and easy to code.


<div class="step" data-rotate-x="200" data-y="200" data-z="100" data-rotate="45" data-scale="-5" id="its-in-3d">

  <!-- here you could use your own style of HTML coding for contents --> 
<p>it's a 3d view here..</p>

</div>

<!-- this is the last slide of the presentation mentioned with id="return" to go back to our first slide -->

<div id="return" class="step" data-rotate="0" data-y="2000" data-x="2000">
<p>join us ! code with us or create ideas | visit www.github.com/shivasurya</p>
    </div>

<!-- this can be hint for users to naviagte with spacebar or arrow keys -->

<div class="hint">
    <p>Use a spacebar or arrow keys to navigate</p>

</div>



contributors have added some audio and other specific functions go through them in Github official impress.js.if you can find more options and bugs in my demo/code comment below!

This can be more innovative and interesting when you can think logically using graphs.other can simply use the template provided.I have mentioned options which i have used in this presentation,if i had missed out or any bugs,comment and notify me via E-mail.share is care.

Tuesday, 20 May 2014

working with ibm bluemix for deploying PHP application on cloud - cloud foundry

As i mentioned about my cloud experience in Heroku and attended a workshop on IBM cloud ,i had an opportunity to deploy my php application on +IBM.I got success in deploying my PHP application instant manner from my windows platform.i am so thankful to +vikas sir for introducing the bluemix through workshop session,as i mentioned in my last post.bluemix is under beta version and open to all till june.





Scope:

we could deploy php application on cloud,Create services and run database.Since i am currently using Windows 8 i would show commands and screenshot from Command Prompt.

Requirements:

> IBM ID (mandatory) with developer registration(may be useful for forums)
> Sign Up for Beta Bluemix with IBM ID (Click Here)
> Constant Internet Connection ;)
> A small php project

Installation:

Go to Official Download page for cloud foundry tool for connecting with cloud.

1) It's better to download the Stable version.
2) Select the appropriate OS and download the zip and extract.
3) Run the installer with Admin Permissions only then You won't get errors.

After Installation:

Just it will be installed In Program files in your Windows Local Disk.
1) Now open your Command prompt with Administrative Permission.
2) And type "cf" and space "-v" (option)

    C:/>cf -v   // it must output with version number of the Cloud foundry tool Application


thus CF tool is working in your command prompt.lets start initial steps to deploy our application.


manifest.yml:

This is the important step in deploying app.This is the basic app settings ,it speaks with the cloud that you need the particular setup to run your corresponding app.Simply saying it is going to initialize cloud environment for deploying.So,let us concentrate on creating manifest.yml file.note this file must be with your project files while uploading.


---
applications:
- name: NAME-OF-YOUR-FOLDER-APP
  memory: 256M
  instances: 1 
  host: WEBSITE_ADDRESS_FOR_YOUR_APP(host)
  buildpack: https://github.com/dmikusa-pivotal/cf-php-build-pack


Actual manifest.yml of my app (note that above three hyphens must be mandatory and hyphen before name is also must)

don't change Buildpack(pulling it from git php built pack),memory(actual RAM memory limit) and instance(balance load using instance).if you change it you may be charged accordingly as per price plans.



---
applications:
- name: myapp
  memory: 256M
  instances: 1 
  host: shivamyapp
  buildpack: https://github.com/dmikusa-pivotal/cf-php-build-pack


see through that your host must be unique(app web address).may be in future you can make it your custom domain.

Deployment of app:

1) Just point your API .type this in your command prompt(ADMIN)
C:/> cf api https://api.ng.bluemix.net

2) and change directory where your project file to be uploaded.
C:/> cf login

3) Enter your E-Mail ID and Password of IBM ID
just click on it and view cf login
4) after changing directory where your project exisit.(move inside where manifest.yml present) and type the command
$ cf push myapp

since i had named my folder project name i had written as myapp(replace with your app project folder name and must be same as application name in manifest.yml)

5) by executing above command just you must get like this below image.That your upload works and moving to cloud foundry.
your project file uploading via CMD
6) After that it executes many configuration and restarts the application.this mean that your Host name is correct and working.
go to Provided_Host_name.ng.bluemix.net (hostname provided in manifest.yml)
eg: myapp.ng.bleumix.net

7) While updating your application just use step number 4,5.

note: Work with caution because cloud may costs you money for over usages and scalling instance.And you can use HTTPS connections too.

I have deployed my application on Bluemix.just have a try since it is free till june month 2014.just share your experience with comments and post errors.Contact with me in s.shivasurya@gmail.com.Share is care.

Thursday, 15 May 2014

introduction to cloud computing - new way approach for business by IT industry - post snippet by @nancy joslin

workshop

+SHIVA SURYA , (author of @i-visionblog) myself attended the recent workshop on cloud computing and big data analytics with my department members +siddarth velmurugan , +venkat raman , +SRIRAMAMOORTHY S & +Varshi Ramesh.

a video that explains very well on cloud computing.
The team from +IBM , +Vikas Manoria ,sir was explaining in awesome manner about the usage,needs and other aspects technically about #cloud computing and it's working and last we had a great demo on Bluemix,a cloud based application deployment startup from IBM with J2EE simple application running on cloud integrating with Twitter API.I had previously guided you guys deploying the web application on cloud.the same way IBM provides excellent solution to deploy apps on cloud with many configuration.I will be writing a post within a week to deploy a PHP based web application with mongoDB as database on Bluemix.

so let us see about some basic concepts on cloud concept :

When a new business is started, they spend time and money to build IT infrastructures which provide hardware, software, services and they need power, larger data center, storage, servers, networks etc. But their growth get slower. In this case Cloud Computing can be implemented. It provides virtual data centers with software, and hardware and information resources, reduces money spending and avoids huge capital investments. 

Cloud computing is simply a service in which computers are connected to 

• connected to larger data centers with lot of software so they need not spend money to buy individual license 

• connected to hardware sources so they need not build, upgrade, maintain infrastructure 

• connected to information resources so they need not go all around the world for collecting information 

This doesn’t require much, all it need is internet and an account as we create in Gmail for example. But the serious problem is the security data to be stored in data centers go through networks and are sometimes hacked by black hats and lot more.however we have SSL(priavate/public key encryption) and other algorithms to encrypt data and data protection by particular operating systems.

To rectify this, cloud computing is available in three models as

• Private - secure, to one company alone, not much efficient.

• Public - not much secure, highly efficient.

• Hybrid - combination of private and public models, secure and more efficient.

Cloud computing provides all service as 


• IaaS – Infrastructure as a service(demanding infrastructure particularly).

• PaaS – Platform as a service(demanding platform such as OS particularly).

• Saas – Software as a service(instant for testers to include add-ons like mysql,mongodb).

More than half of US are pulled into this. By the 3rd into Everything as a Service (EaaS) instead of infrastructure, platform, software as individual service. They are expecting that the total market of cloud will reach $158.8 billion. In forth coming years Hybrid cloud will be more adopted and total market rises to great extends.

so which industry,application needs cloud storage,hosting ?


> Applications such as pinterest runs on cloud based service where the traffic would be quite large and to manage them.

> Industries such as logistics and other industries which need real time statistics and data to manage customers and provide opt services on time.

> growing industry for big data analysis to challenge their opponents with present data.

> finally marketing feedbacks,data etc for products a needs a huge storage where they can be stored and retrieved without loss of data and perfomance.

and where the industry could handle large amount of data.

And finally cloud is vast concept to describe ,and only you can experience it when you really work it on by deploying small applications and experiencing how cloud manages the and traffic.share is care.

Wednesday, 9 April 2014

how does facebook check-in works with Bing maps API with facebook pages (PART 1/3)

This is another post after Facebook custom stories for facebook application which made me more crazy to learn about the Bing Maps API to retrieve maps using AJAX 7 technique or REST API service provided by MICROSOFT.

you guys would be fascinated in updating status and photos ,events and others with check-in places and tag with your friends.Generally facebook always displays the Bing Maps for those check-in.These check-ins are actually born at Pages/place you create and give access via GPS to locate your device and get Latitude and longitude details to query Bing maps API and obtain maps to display to users and friends.



There are lot of parameters in getting map for exact location and corresponding maps for various platforms with various methods.i am here discussing about web(desktop) Rest API request and AJAX 7.

first of all let us see how to make location based request with BING API in this post:

1)
Go to Bing Maps API and register a new Application with Microsoft Live Account.


2) Create a Bing Map KEY for retrieval and authentication purpose(generally making API calls secure from anonymous calls)

3) Create with BASIC keys and provide as NON PROFIT as category for safer side usage.

4) Copy your KEY which is registered with correct Domain name URL.

Lets have a look at the simplest BING MAPS API CODE to retrieve location based on QUERY.
     <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

<script type="text/javascript">

var map = null;

function GetMap()
{
// Initialize the map
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),{credentials:"Aoyuj93YnzHbS8ZBLA6sdcvsdvzcxvcsyv2ASBjCJlICSIVobIZt3bZhwTzr-egVhMmlf-f8IKpM", mapTypeId:Microsoft.Maps.MapTypeId.road});

}

function ClickGeocode(credentials)
{
map.getCredentials(MakeGeocodeRequest);
}

function MakeGeocodeRequest(credentials)
{

var geocodeRequest = "http://dev.virtualearth.net/REST/v1/Locations?query=" + encodeURI(document.getElementById('txtQuery').value) + "&output=json&jsonp=GeocodeCallback&key=" + credentials;

CallRestService(geocodeRequest);
}

function GeocodeCallback(result)
{
alert("Found location: " + result.resourceSets[0].resources[0].name);

if (result &&
result.resourceSets &&
result.resourceSets.length > 0 &&
result.resourceSets[0].resources &&
result.resourceSets[0].resources.length > 0)
{
// Set the map view using the returned bounding box
var bbox = result.resourceSets[0].resources[0].bbox;
var viewBoundaries = Microsoft.Maps.LocationRect.fromLocations(new Microsoft.Maps.Location(bbox[0], bbox[1]), new Microsoft.Maps.Location(bbox[2], bbox[3]));
map.setView({ bounds: viewBoundaries});

// Add a pushpin at the found location
var location = new Microsoft.Maps.Location(result.resourceSets[0].resources[0].point.coordinates[0], result.resourceSets[0].resources[0].point.coordinates[1]);
var pushpin = new Microsoft.Maps.Pushpin(location);
map.entities.push(pushpin);
}
}

function CallRestService(request)
{
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}

</script>
See the Pen facebook like check-in [part 1/2] basic usage of bing API by s.shivasurya (@shivasurya) on CodePen.


Demo here - LINK 

so what happens in above code as simple and short and sweet:

1) we got the key from Bing API official used them rite at the place (credential mentioned in code)

2) using the key we made a user query place(eg:coimbatore) and which is sent via URL as REST API CALL with javascript help.

3) after STATUS 200 we get the result in JSON/XML (as we mention in URL PART)

4) by appending the result in browser we could get the place with Pushpin and we could get LATITUDE/LONGITUDE info also here which can be stored in database.

5) note that the resultant map is in form of Image as tiles (parts) can be saved and used personally.and the link can be useful later part.

thus we have successfully queried a place with longitud/latitude and an image.with this in next tutorial i would explain how pages/events/status check-in's works and btw we could create simple Check-in applications also.

i have tested this above code worled well and came across many errors! you can discuss errors with me hope i can provide solutions as comments/Email,Share is Care.

Tuesday, 11 March 2014

Android Stepping into Space - Post snippet by @nancy.joslin

android stepping into space- i-visionblog.com
We use Smartphone for many purposes but some minds planned to land it in space and they achieved it.
An ongoing project of NASA, Phonesat made their goal successful. Phonesat is a nano-satellite which uses Smartphone and run on android platforms. This idea was suggested in order to reduce the cost of the satellites. This android satellite is launched into the lower orbit of the earth.
Phonesat was developed for the first time in 2009 at NASA Ames Research Center in Moffett field, California. Various versions are being developed and ready to launch. They are launched as test samples now.

Advantages of this phonesat is that they have faster CPU than the other satellites, one or two cameras for capturing images of earth and space, rotation sensors to detect and orient the satellite , GPS receiver to receive commands, radios to send images .It uses Li-Ion batteries (Lithium ions batteries).

PHONESAT 1.0:

Phonesat 1.0 is the first nano-satellite launched into the low earth orbit. It used Nexus One (Smartphone from HTC & Google) which uses android 2.3.3 operating systems. This was designed with three prototypes at a cost of $3500 for each prototype .This satellite runs in 12 Li-Ion batteries .They had no solar panels. It is approximately 10x10x10cm (4 inch) cube.
                The mission of this phonesat 1.0 is to obtain digital images of earth and space through the camera. This satellite is capable of staying alive for short period in space .The images and satellite health were sent as radio signals via inbuilt radio.This nanosatellite was tested under various conditions in various environments like thermal-vacuum chamber, alpha and beta radiations, vibration and shock tables, high altitude balloons. Phonesat 1.0 was named as GRAHAM and next was named as BELL with Iridium transceiver mounted at one end to receive and send information.

PHONESAT 2.0

Phonesat 2.0 uses Nexus s (from Samsung) which runs on Google android 2.3.3 platform. It has solar panels, 4 Li-Ion batteries, two ways S-band radio to communicate with earth and GPS receiver.ALEXANDER is the name of this satellite, it is also called as Phonesat 2.0 beta, phonesat v2a. This satellite sends packets over amateur radio at 437.4 MHz . This is programmed in such a way that when the packets are not sent it reboots the phone.

PHONESAT 2.4

Phonesat 2.4 also uses Nexus s and android version 2.3.3. It uses 2ways-band radio and it has super control over the orientation of the phone. The Smartphone works as the computing unit and its camera observes the earth while its sensors senses and orient the satellite.
ANTARES 110 launch vehicle on 21 April 2013 carried two phonesat 1.0(GRAHAM and BELL) and one phobesat 2.0(ALEXANDER) and set them in the orbits. It was alive for 2 weeks in space and images sent by phonesat are below here .

 (a) Picture of earth sent by BELL. 

 (b) Picture of earth sent by GRAHAM.









MINOTAUR LORS-3 launch vechile carried phonesat 2.4 and Phonesat 2.5 is being developed and NASA will launch very soon.
author info:

Author       : Nancy joslin , Dharshini and shivaranjani

contact us : visit our facebook fan page i-visionblog and feel free to comment below.

Wednesday, 12 February 2014

working with webcam.js and php to upload images- learnmore i-visionblog.com

We all guys are fascinated towards uploading images via social networks by applications.Thus introduction of webcam made a lot of changes as such direct upload of images and video calling starting from skype to viber,hangouts in G+ plays a major role in the information sharing and visualizing.and this post will give a start up on the accessing webcam via browser and uploading using PHP and managing them with MySQL database in backend.

webcam.js - resource
                                                           
Let us create a table named images :
create a images folder before trying it.

CREATE TABLE IF NOT EXISTS `image` (
`images` varchar(1200) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(1000) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


Let us Know about javascript functions of webcam.js
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.write( webcam.get_html(440, 240) );
</script>
this functions enable to show the cam in your browser.you can mention the size of the cam to present in your browser.
<script  type="text/javascript">
    webcam.set_api_url( 'handleimage.php' );
webcam.set_quality( 90 );
webcam.set_shutter_sound( true ); // play shutter click sound
webcam.set_hook( 'onComplete', 'my_completion_handler' );

this function set initial value for API url to process our image and save in uploads.and other functions are just attribute such as sound,quality and calling the functions.
function take_snapshot(){
document.getElementById('img').innerHTML = '<h1>upload on progress</h1>';
webcam.snap();
}

This function is initiated when the user triggers the snap button.when the user clicks the button Just show loading status message and call the function webcam.snap() to capture the image through the webcam.

function my_completion_handler(msg) {
// this is used to extract the url php output
if (msg.match(/(http\:\/\/\S+)/)) {
//the above expression is to verify the match url output
document.getElementById('img').innerHTML ='<h3>Upload Successful</h3>'+msg;
    // show JPEG image in page
document.getElementById('img').innerHTML ="<img src="+msg+" class=\"img\">";
//initialize the camera once again
webcam.reset();
}
else {alert(" Error occured! we are right now down to take photoshoot : " + msg); }
}

This function is called to handle the error or success of image upload and helps to display image and initialize the webcam once again.
so now let us code for the backend handleimage.php
<?php
session_start();
$_SESSION['id']="1";
$id=$_SESSION['id'];
include 'connection.php';  //assume you have connected to database already.
$name = date('YmdHis');
$newname="images/".$name.".jpg";
$file = file_put_contents( $newname, file_get_contents('php://input') );
if (!$file) {
print "Error occured here";
exit();
}
else
{
    $sql="insert into image (id,name,images) values ('','$id'.'$newname')";
    $result=mysqli_query($con,$sql);
    $value=mysqli_insert_id($con);
    $_SESSION["myvalue"]=$value;

}
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $newname;
print "$url\n";
?>
This enables to get your image file using the file_get_contents().here is a small explanation php://input -read article here.
and adding the image path to the database table with id,name and path.and we are just printing the url of the image with our environment variables in PHP.
so,now let us design our index.php.
<html>
<body style="background-color:#dfe3ee;">
<div id="outer" style="margin:0px; width:100%; height:90px;background-color:#3B5998;">
</div>
<div id="main" style="height:800px; width:100%">
<div id="content" style="float:left; width:500px; margin-left:50px; margin-top:20px;" align="center">
<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
document.write( webcam.get_html(440, 240) );
</script>
<form>
<br />
<input type=button value="Configure settings" onClick="webcam.configure()" class="shiva">
&nbsp;&nbsp;
<input type=button value="snap" onClick="take_snapshot()" class="shiva">
</form>
</div>
<script  type="text/javascript">
    webcam.set_api_url( 'test.php' );
webcam.set_quality( 90 ); // JPEG quality (1 - 100)
webcam.set_shutter_sound( true ); // play shutter click sound
webcam.set_hook( 'onComplete', 'my_completion_handler' );

function take_snapshot(){
// take snapshot and upload to server
document.getElementById('img').innerHTML = '<h1>Uploading...</h1>';

webcam.snap();
}

function my_completion_handler(msg) {
// extract URL out of PHP output
if (msg.match(/(http\:\/\/\S+)/)) {
// show JPEG image in page

document.getElementById('img').innerHTML ='<h3>Upload Successfuly done</h3>'+msg;
 
document.getElementById('img').innerHTML ="<img src="+msg+" class=\"img\">";


// reset camera for another shot
webcam.reset();
}
else {alert("PHP Error: " + msg); }
}
</script>
  <div id="img" style=" height:800px; width:500px; float:left; margin-left:40px; margin-top:20px;">
</div>
</div>
</body>
</html>

let us add some cool CSS code :
<style type="text/css">
body{
margin:0;
padding:0;
}
.img
    { background:#ffffff;
    padding:12px;
    border:1px solid #999999; }
.shiva{
 -moz-user-select: none;
    background: #2A49A5;
    border: 1px solid #082783;
    box-shadow: 0 1px #4C6BC7 inset;
    color: white;
    padding: 3px 5px;
    text-decoration: none;
    text-shadow: 0 -1px 0 #082783;
    font: 12px Verdana, sans-serif;}
</style>

I am leaving on your side to make alteration if need for getting image and rename + uploading and other sorts of make ups.this is the basic to get the image and save it in a folder named images.
report any bugs as comments.share is care, please share it.