metanohi-misc-subsites/projects/x/htrtp.php

53 lines
1.3 KiB
PHP
Raw Normal View History

2011-08-02 19:57:57 +02:00
<?php
$addr=$_SERVER['QUERY_STRING'];
if ($addr=="") $addr="img/linux.png";
$dim=getimagesize($addr);
$w=$dim[0];
$h=$dim[1];
for ($i=0; $i<$w; $i++) {
for ($ii=0; $ii<$h; $ii++) {
$img.="<div style='clip: rect(".($h-$ii)."px, ".($w-$i)."px, ".($h-$ii-1)."px, ".($w-$i-1)."px); left: ".(($w-$i-1)*-1+$i)."px; top: ".(($h-$ii-1)*-1+$ii)."px;'></div>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml">
<head>
<title>JS-PHP HTMLrotate (PHP)</title>
<style type='text/css'>
.a {
float:left;
border-width:1px 0 0 0;
border-style:solid;
border-color:#000;
margin-right:10px;
}
.a div {
border-width:0 1px 1px 1px;
border-style:solid;
border-color:#000;
position:relative;
padding:3px;
}
.i {
height:60px;
}
.a div div {
border:0;
background-image:url('<?php echo $addr; ?>');
background-repeat:no-repeat;
position:absolute;
width:<?php echo $w; ?>px;
height:<?php echo $h; ?>px;
}
</style>
</head>
<body>
<div class='a'><div>Original image</div><div class='i'><img src='<?php echo $addr; ?>' /></div></div>
<div class='a'><div>Rotated image</div><div class='i'><?php echo $img; ?></div></div>
</body>
</html>