66 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| $addr=$_SERVER['QUERY_STRING'];
 | |
| if ($addr=="") $addr="img/linux.png";
 | |
| $dim=getimagesize($addr);
 | |
| $w=$dim[0];
 | |
| $h=$dim[1];
 | |
| ?>
 | |
| <!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 (JS)</title>
 | |
| <style type='text/css'>
 | |
| div {
 | |
|   background-image:url('<?php echo $addr; ?>');
 | |
|   background-repeat:no-repeat;
 | |
|   position:absolute;
 | |
|   }
 | |
| </style>
 | |
| <script type='text/javascript'>
 | |
| mw=<?php echo $w; ?>
 | |
| 
 | |
| mh=<?php echo $h; ?>
 | |
| 
 | |
| function load() {
 | |
| addr="<?php echo $addr; ?>"
 | |
| img=new Image()
 | |
| img.src=addr
 | |
| img.onload=function() {
 | |
| w=img.width
 | |
| h=img.height
 | |
| ow=w
 | |
| oh=h
 | |
| if (w>h) {
 | |
| if (w>mw) {
 | |
| h=(mw/w)*h
 | |
| w=mw
 | |
| }
 | |
| }
 | |
| else {
 | |
| if (h>mh) {
 | |
| w=(mh/h)*w
 | |
| h=mh
 | |
| }
 | |
| }
 | |
| //document.title=ow+"/"+oh+" - "+Math.round(w)+"/"+Math.round(h)
 | |
| 
 | |
| d=document.body
 | |
| for (i=0; i<w; i++) {
 | |
| for (ii=0; ii<h; ii++) {
 | |
| div=document.createElement("div")
 | |
| div.style.clip="rect("+(h-ii)+"px,"+(w-i)+"px,"+(h-ii-1)+"px,"+(w-i-1)+"px)"
 | |
| div.style.left=((w-i-1)*-1+i)+"px"
 | |
| div.style.top=((h-ii-1)*-1+ii)+"px"
 | |
| div.style.width=w+"px"
 | |
| div.style.height=h+"px"
 | |
| d.appendChild(div)
 | |
| }
 | |
| }
 | |
| 
 | |
| }
 | |
| }
 | |
| window.onload=load
 | |
| </script>
 | |
| </head>
 | |
| <body></body>
 | |
| </html>
 |