<?php
session_start();

?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Site perso,cours,ouvrages" />
<meta name="Keywords" content="WEBSITE perso " />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="" />
<meta http-equiv="Content-Language" content="fr" />
<meta name="rating" content="general" />
<meta name="author" content="Patrice DELPY" />
<meta name="copyright" content="Copyright 2013" />
<meta name="generator" content="Patoche" />
<title>Patoche WEBSITE - 2013 - Template du site - en cours de développemment ...</title>
<link rel="shortcut icon" href="images/mosfet.ico" type="image/x-icon">

<style type="text/css">

#box2 {
		position:absolute;
		top: 50px;
		right: 50px;
	}
	
#img {
width: 100%;
height: 100%;
}	

</style>

<script type="text/javascript">

function scaleImg() 
{
what = document.getElementById('thepic');
actualHeight=what.height; 
actualWidth=what.width;
if (  fitsInWindow() ) 
return;
if(what.width==tableWidth())
 {
what.width=actualWidth;
what.height=actualHeight;
}
else
{
what.style.cursor = "pointer";
what.width=tableWidth();
what.height = (actualHeight/actualWidth) * what.width;
}
}

function fitsInWindow() {
   what = document.getElementById('thepic');
   var  actualWidth= what.width;
  if (actualWidth<tableWidth()) {

   return true;
  } else {
  return false;
  }
  }
  
function tableWidth()
{return windowWidth()-100;}

function windowWidth() {
if (navigator.appName=="Netscape")
return window.innerWidth;

return document.body.offsetWidth;
}  

function showOnclick()
{
what = document.getElementById('thepic');

if (actualWidth == what.width)
        return scaleImg();
else if (actualWidth > what.width)
{
what.width=actualWidth;
what.height=actualHeight;
}
}

</script>

</head>

<body>


<?php

	echo $_GET['image'];
	echo "<br>";
	echo "<br>";
	
	// format type
	//$image = "Users\images\MET-ART_AF_710_0027.jpg";
	// remplace \ par /
	$image = str_replace("\\", "/", $_GET['image']);
	echo "---> " .$image; 
	
/*	$test = substr($image,0,1);
	//echo $test;	
	if($test == "/")
	{	// suppression le premier element qui est /
		$image = substr($image,1);
		//echo "trace";
	}
	echo "<br>";
	echo $image;
	echo "<br>";*/
//	$image = str_replace($_SESSION['repertoire'], "", $image);
	//$image = explode("/", $image );
//	$image = substr($image, 1);
//	echo $image;
	echo "<br>";
	echo "<br>";
	echo "<br>";
	//$repertoire_image = "/homez.65/analogde/www" .$_GET['image'];  
	
	//$image = "C:\Logiciels\Internet\wamp\www\DEBUG_28_09_2015\01.jpg";
	//$image = "01.jpg";
	list($width, $height, $type, $attr) = getimagesize($image); 
	$taille = format_size(filesize($image));

	$array = explode("/", $image );
	end($array);
	echo   $_SESSION['repertoire'] ."\\" .end($array) .":  " ."<br><br>" .$width ."px"  ."&" .$height ."px" ."               " .$taille;

	echo '<div id="box2">';
	echo '<a><img id="clickback" border="0" src="images/go_back.png" onclick="history.go(-1)" style="cursor: pointer" title= "Retour"></a>';
	echo '</div>';

	echo '<div style="text-align:center;">';
	echo '<a href="#" onClick="showOnclick()"><img id="thepic" onLoad="scaleImg();"  src = '.$image.'  ALT="Texte remplaçant l\'image"  TITLE="Image">';
	echo '</div>';


	///echo "<img src = 'Users/abc/un/kate.jpg' alt='Partenaires'>";
		
	
	
?>

<?php

function format_size($size) {
      $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
      if ($size == 0) { return('n/a'); } else {
      return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $sizes[$i]); }
}

?>



</body>
</html>