103 lines
3.5 KiB
PHP
103 lines
3.5 KiB
PHP
<?php
|
|
exit();
|
|
if(isset($_GET['it'])){
|
|
$dir = 'upload/iup/';
|
|
$file = str_replace('upload/iup/','',$_GET['it']);
|
|
if(file_exists($dir.$file)){
|
|
if(isset($_GET['r'])){
|
|
$image = $dir.$file;
|
|
$new_image = $dir.$file;
|
|
|
|
$img = imagecreatefromjpeg($image); // Картинка
|
|
$degrees = $_GET['r']; //Наклон картинки
|
|
$imgRotated = imagerotate($img, $degrees, 0);
|
|
imagejpeg($imgRotated, $new_image, 90); // Новая картинка
|
|
}
|
|
|
|
echo echo_head();
|
|
echo '<div class="plaha">Повернуть:
|
|
<a href="#" class="btnRotate1" id="90">90</a> |
|
|
<a href="#" class="btnRotate1" id="-90">-90</a> |
|
|
<a href="#" class="btnRotate1" id="180">180</a>
|
|
</div>';
|
|
echo '<img src="'.$dir.$file.'" class="my-foto" data-large="'.$dir.$file.'" title="Фото">';
|
|
echo '<style>
|
|
.my-foto{
|
|
width:100%;
|
|
max-width:100%;
|
|
position:absolute;
|
|
top:0px;
|
|
left:0px;
|
|
}
|
|
.plaha{
|
|
position:absolute;top:0px;left:0px;z-index:99999;background-color:#fff;padding:10px;
|
|
}
|
|
</style>';
|
|
echo '<script>jQuery(function(){
|
|
$(".my-foto").imagezoomsl({
|
|
zoomrange: [1, 12],
|
|
zoomstart: 4,
|
|
innerzoom: true,
|
|
magnifierborder: "none"
|
|
});
|
|
|
|
$(".btnRotate1").click(function(){
|
|
var degree = $(this).attr("id");
|
|
$.get( "viewfile.php?it='.$file.'&r="+degree, function( data ) {
|
|
location.reload();
|
|
});
|
|
return false;
|
|
});
|
|
$(".btnRotate").click(function(){
|
|
var degree = $(this).attr("id");
|
|
var w = $(".my-foto").width();
|
|
var h = $(".my-foto").height();
|
|
rotateImage(degree);
|
|
$(".my-foto").css({"top":"-"+(w/2)+"px"});
|
|
return false;
|
|
});
|
|
function rotateImage(degree) {
|
|
$(".my-foto").animate({ transform: degree }, {
|
|
step: function(now,fx) {
|
|
$(this).css({
|
|
"-webkit-transform":"rotate("+now+"deg)",
|
|
"-moz-transform":"rotate("+now+"deg)",
|
|
"transform":"rotate("+now+"deg)"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});</script>';
|
|
}
|
|
}
|
|
function echo_head(){
|
|
$out = '<!DOCTYPE html>
|
|
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
|
|
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
|
|
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Просмотр фото</title>
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
<meta content="" name="description" />
|
|
<meta content="" name="author" />
|
|
<link href="/tpl/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
|
<link href="/tpl/assets/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" />
|
|
<link href="/tpl/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
|
|
<link href="/tpl/css/style.css" rel="stylesheet" />
|
|
<link href="/tpl/css/style-responsive.css" rel="stylesheet" />
|
|
<link href="/tpl/css/style-default.css" rel="stylesheet" id="style_color" />
|
|
<link href="/tpl/assets/fancybox/source/jquery.fancybox.css" rel="stylesheet" />
|
|
<link rel="stylesheet" type="text/css" href="/tpl/assets/uniform/css/uniform.default.css" />
|
|
<link rel="stylesheet" type="text/css" href="/tpl/assets/chosen-bootstrap/chosen/chosen.css" />
|
|
<link rel="stylesheet" type="text/css" href="/tpl/assets/jquery-tags-input/jquery.tagsinput.css" />
|
|
<link rel="stylesheet" type="text/css" href="/tpl/assets/clockface/css/clockface.css" />
|
|
<link rel="stylesheet" type="text/css" href="/tpl/assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
|
|
<script src="/tpl/js/jquery-1.8.3.min.js"></script>
|
|
<script src="/tpl/js/zoomsl-3.0.min.js"></script>
|
|
</head><body>';
|
|
return $out;
|
|
}
|
|
?>
|
|
|