function positionFromSmallToLarge($positions=array(‘x’=>0,’y’=>0),$dms=array(‘w’=>0,’h’=>0),$dml=array(‘w’=>0,’h’=>0))
{
#POSITIONS FOR LARGE IMAGE
$largeX = 0;//UNKNOWN
$largeY = 0;//UNKNOWN
#DIMENSIONS LARGE ARE
$largeWidth = $dml[‘w’];
$largeHeight = $dml[‘h’];
#DIMENSIONS SMALL ARE
$smallWidth = $dms[‘w’];
$smallHeight = $dms[‘h’];
#POSITIONS OF AN OBJECT SPOTTED ON SMALL IMAGE ARE
$smallX = $positions[‘x’];
$smallY = $positions[‘y’];
$percentFromLeft = ($smallX/$smallWidth); #CONSIDER IT IN PERCENT WITHOUT X 100 🙂
$percentFromTop = ($smallY/$smallHeight); #CONSIDER IT IN PERCENT WITHOUT X 100 🙂
#POSITIONS FOR LARGE IMAGE ARE
$largeX = $percentFromLeft*$largeWidth;
$largeY = $percentFromTop*$largeHeight;
$largePostions = array(‘x’=>$largeX,’y’=>$largeY);
return $largePostions;
}
Last updated: March 19, 2014