Last night, while surfing the net i came through a very quite intresting game. It was a photo comparison game, you have remebered such type of game appearing in many of the children edition newspaper. Simultaneously, two photos are displayed one they called the original and other having some errors in it, and you have to find out the error. If you've gone through other's of my article, you've come to know that i never write actually the full code of the problem. What i do is to just provide you with the logic. Thus, here i've written just some part of the code, giving you the diving force to write the code for the full game.

Here i've used Image-select Area jquery plugin, which is available under the dual mit and gnu public license. To use the plugin, please go through the page link, which will guide you on it's usage instruction.


<!DOCTYPE html>
<script src="">
<link rel="stylesheet" type="text/css" href="css/imgareaselect-default.css" ><link/> 
<script type="text/javascript" src="scripts/jquery.min.js">
<script type="text/javascript" src="scripts/jquery.imgareaselect.pack.js">
function setInfo(i, e) 
} $(document).ready(function () { 
$('img#photo').imgAreaSelect({ handles: true, onSelectEnd: setInfo }); });
<form method="POST" action="index.php" width="500px" height="250px"> 
<img id="photo" src="map.jpg"></img>
<input type="hidden" id="x" name="x" >
<input type="hidden" id="y" name="y" > 
<input type="hidden" id="w" name="w" >
<input type="hidden" id="h" name="h" > 
<input type="submit"/> 

        echo "
Area = ".$_REQUEST['w']*$_REQUEST['h']; echo "
"; echo "w cor = ".$_REQUEST['w'];echo "
"; echo "h cor = ".$_REQUEST['h'];echo "
"; echo "x cor = ".$_REQUEST['x'];echo "
"; echo "y cor = ".$_REQUEST['y'];echo "
"; . . .

  • Since,our setinfo() method has already done feeding work, now let see the result by echoing all the four of them. This is just the unnecessary part, included just to make you understand better.
  • I've arbitrary selected the encircle region(depicted in the below figure) as our desiered region.

  • select region

         if($_REQUEST['w']*$_REQUEST['h']<11000 && ($_REQUEST['x']>141) && $_REQUEST['x']<149 && $_REQUEST['y']<76 && $_REQUEST['y']>68 )
                echo "
    You selected the desired region.
    "; } }

    All rights reserved, the content is copyrighted to the author.