<?
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

include('imageAdaptation.php');



$i='imgc/eye.jpg';
$s = microtime(true);
$imgurl=convertImage($i);
$e = microtime(true);

$ua=getUA();
$isMob=isMobile($ua);


list ($imwidth,$imheight)= getimagesize($i);

if ($isMob=='0')
{
$imgD=$imwidth."X".$imheight;
$devD="Full Screen";
$convD=$imgD;
}
else
{
list($format,$devwidth,$devheight,$resizeOption)= getCAP($ua);
list($Rwidth,$Rheight)=setImageDimension($imwidth,$imheight,$devwidth,$devheight);
$imgD=$imwidth."X".$imheight;
$devD=$devwidth."X".$devheight;
$convD=$Rwidth."X".$Rheight;
}
?>
<html>
<head>
<title>Testing Image Transcoding</title>
</head>
<body>
<table border=1>
  <tr><td><div align="center">
  <?
  if ($isMob=='1')
    echo 'Request from Mobile Device';
  else 
    echo 'Request from Desktop. So NO Resize.';
  ?></div>
  </td></tr>
  <tr>
<td><b><? print "Time taken: " . floor(($e - $s)*1000) . "ms\r\n";?></b></td>
</tr>
  <tr><td><img src="<? echo $imgurl; ?>">
  
  </td></tr>
  <tr><td><b>Main Image Path:</b> <? echo $i; ?></td></tr>
  <tr><td><b>Converted Image Path:</b> <? echo $imgurl; ?></td></tr>
  
  <tr><td>
    <table width="100%" border="1">
    <tr>
    <td><b>Image(Main):</b> <? echo $imgD; ?></td>
    <td><b>Device:</b> <? echo $devD; ?></td>
    <td><b>Image(Resized):</b> <? echo $convD; ?></td>
    </tr>
    </table>
  </td></tr>
  
</table>
</body>
</html>