( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$VideoPath = "uploads/live/";
$live_img = 'uploads/images/';
if($_GET["msg_id"] == "0")
{
$result = $db->getstar4($msg_id);
$msg_id= $result[0]["id"];
$msg_id2 = $db->base64url_encode($msg_id); ;
if (empty($msg_id)){header("Location: index.php?mode=startags"); }
}
else
{
$msg_id2 = $msg_id ;
$msg_id = $db->base64url_decode($msg_id);
$result = $db->getstar2($msg_id);
}
$catalogid = $result[0]["catalogid"];
$yanani= $result[0]["yanani"];
$original= $result[0]["picture"];
$picture= $result[0]["picture"];
$title = $result[0]["title"];
$content = $result[0]["content"];
$viewnum = $result[0]["viewnum"];
$rating = $result[0]["rating"];
$picture = $result[0]["picture"];
$ratenum = $result[0]["ratenum"];
$episodeid = $result[0]["episodeid"];
$slug = $result[0]["slug"];
$keywords = $result[0]["keywords"];
$isdisplay = $result[0]["isdisplay"];
$description = $result[0]["description"];
$vcat = $result[0]["vcat"];
$summary = $result[0]["summary"];
$video = $result[0]["video"];
$thumb= $result[0]["thumb"];
$post_id= $_GET["msg_id3"];
$src="v/uploads/startags/$original";
list($upana, $urefu) = getimagesize($src);
if ($upana > 1500 || $urefu > 1500 )
{
$ratio = $upana/$urefu;
include("pages/supersize.php");
$w=1000;
$h=$w*$ratio;
$quality="100";
img_resizer($src,$quality,$w,$h,$src,$nocrop=0,$force=0);
}
?>
<?php
if (!empty($cropReplace)) {
$_POST = filter($_POST);
$msg_id = $_POST['msg_id'];
$action = $_POST['action'];
$msg_id = $db->base64url_decode($msg_id);
$msg_id2 = $_POST['msg_id'];
$photo = $_POST['photo'];
$targ_w = $_POST['w'];
$mag = $_POST['mag'];
$appno = $_POST['appno'];
$targ_h = $_POST['h'];
$quality = 100;
$src = "v/uploads/startags/$photo";
$src2 = "v/uploads/gthumbs/$photo";
$dst_r = imagecreatetruecolor($targ_w, $targ_h);
// Set up the appropriate image handling functions based on the picture image's mime type
$size = GetImageSize($src);
$mime = $size['mime'];
switch ($size['mime'])
{
case 'image/gif':
// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
// This is maybe not the ideal solution, but IE6 can suck it
$creationFunction = 'ImageCreateFromGif';
$outputFunction = 'ImagePng';
$mime = 'image/png'; // We need to convert GIFs to PNGs
$quality = round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
break;
case 'image/png':
$creationFunction = 'ImageCreateFromPng';
$outputFunction = 'ImagePng';
$quality = round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
break;
default:
$creationFunction = 'ImageCreateFromJpeg';
$outputFunction = 'ImageJpeg';
$quality=100;
break;
}
$img_r = $creationFunction($src);
if (in_array($size['mime'], array('image/gif', 'image/png')))
{
/* exit("ikooooooooooooooooooo");*/
if (!$color)
{
// If this is a GIF or a PNG, we need to set up transparency
imagealphablending($dst_r, false);
imagesavealpha($dst_r, true);
}
else
{
// Fill the background with the specified color for matting purposes
if ($color[0] == '#')
$color = substr($color, 1);
$background = FALSE;
if (strlen($color) == 6)
$background = imagecolorallocate($dst_r, hexdec($color[0].$color[1]), hexdec($color[2].$color[3]), hexdec($color[4].$color[5]));
else if (strlen($color) == 3)
$background = imagecolorallocate($dst_r, hexdec($color[0].$color[0]), hexdec($color[1].$color[1]), hexdec($color[2].$color[2]));
if ($background)
imagefill($dst_r, 0, 0, $background);
}
}
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$targ_w,$targ_h);
$outputFunction($dst_r, $src2, $quality);
include("pages/supersize.php");
$w=600;
$h=600;
$quality="100";
img_resizer($src2,$quality,$w,$h,$src2,$nocrop=0,$force=0);
$time = time();
mysqli_query("UPDATE profilepicture SET isdisplay= '7',adddate='$time' WHERE picture= '$photo'");
header("Location: index.php?mode=startags");
/* header("Location: index.php?mode=updateStartag&msg_id=$msg_id2&category=alert-success&step=0&action=$action"); */
}
?>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.Jcrop.js"></script>
<script type="text/javascript">
jQuery(function($){
// Create variables (in this scope) to hold the API and image size
var jcrop_api,
boundx,
boundy,
// Grab some information about the preview pane
$preview = $('#preview-pane'),
$pcnt = $('#preview-pane .preview-container'),
$pimg = $('#preview-pane .preview-container img'),
xsize = $pcnt.width(),
ysize = $pcnt.height();
console.log('init',[xsize,ysize]);
$('#cropbox').Jcrop({
onChange: updatePreview,
onSelect: updatePreview,
minSize: [ 300, 300 ],
maxSize: [ 1000, 1000 ],
aspectRatio: 600/600 ,
setSelect: [ 1, 1, 300, 300 ],
onSelect: updateCoords,
bgFade: true,
bgOpacity: .3
},function(){
// Use the API to get the real image size
var bounds = this.getBounds();
boundx = bounds[0];
boundy = bounds[1];
// Store the API in the jcrop_api variable
jcrop_api = this;
// Move the preview into the jcrop container for css positioning
$preview.appendTo(jcrop_api.ui.holder);
});
function checkCoords()
{
if (parseInt($('#w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};
function updateCoords(c)
{$('#appno').val(AppNo);
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
};
function updatePreview(c)
{
if (parseInt(c.w) > 0)
{
var rx = xsize / c.w;
var ry = ysize / c.h;
$pimg.css({
width: Math.round(rx * boundx) + 'px',
height: Math.round(ry * boundy) + 'px',
marginLeft: '-' + Math.round(rx * c.x) + 'px',
marginTop: '-' + Math.round(ry * c.y) + 'px'
});
}
};
});
</script>
<link rel="stylesheet" href="demo_files/main.css" type="text/css" />
<link rel="stylesheet" href="css/jquery.Jcrop.css" type="text/css" />
<style type="text/css">
/* Apply these styles only when #preview-pane has
been placed within the Jcrop widget */
.jcrop-holder #preview-pane {
display: block;
position: absolute;
z-index: 2000;
top: 10px;
right: -280px;
padding: 6px;
border: 1px rgba(0,0,0,.4) solid;
background-color: white;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
box-shadow: 1px 1px 5px 2px rgba(0, 0, 0, 0.2);
}
/* The Javascript code will set the aspect ratio of the crop
area based on the size of the thumbnail preview,
specified here */
#preview-pane .preview-container {
width: 250px;
height: 170px;
overflow: hidden;
}
</style>
<table width="100%" border="0">
<tr>
<td width="348" ><h2 style="margin-top:0px" class="post-title" id="status"> <i class="icon-asterisk"></i>Crop Photo</h2> </td>
<td align="right">
<?php $msg_idx = $db->base64url_encode($msg_id); ?>
<form action="index.php?mode=cropR" method="post" onsubmit="return checkCoords();">
<?php if(!empty($mag))
{?>
<input type="hidden" id="mag" name="mag" value="mag" />
<?php }
?>
<input type="hidden" id="action" name="action" value="<?php echo $_GET["action"]; ?>" />
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="appno" name="appno" />
<input type="hidden" id="h" name="h" />
<input type="hidden" id="photo" name="photo" value="<?php echo $original ?>" />
<input type="hidden" id="msg_id" name="msg_id" value="<?php echo $msg_idx ?>" />
<?php /*?> <input type="submit" name="skip" value="Skip" class="btn-lg btn-info " style=" background-color:#333; margin-top:2px;border:0px;width:105px; margin-right:5px" /><?php */?>
<input type="submit" name="cropReplace" value="Crop" class="btn-lg btn-info pull-right m-b" style=" margin-top:2px;border:0px;width:105px; margin-right:5px; background-color:#F2B601" />
</form></td>
</tr>
</table>
<div id="preview-pane" style="display:none">
<div class="preview-container">
<img src="" class="jcrop-preview" alt="Preview" />
</div>
</div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
<img src="taswira.php?nocache=1&image=/v/uploads/startags/<?php echo $picture ?>#<?php rand(1,3);?>" style="-moz-border-radius : 3px 3px 3px 3px:-webkit-border-radius : 3px 3px 3px 3px;border-radius : 3px 3px 3px 3px; " id="cropbox" >
</td>
</tr>
</table><br />