( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$VideoPath = "uploads/live/";
$live_img = 'uploads/images/';
if($_GET["msg_id"] == "0")
{
if(!empty($_GET["type"]))
{
$result = $db->getReplace($msg_id);
$msg_id= $result[0]["themeid"];
}
else
{$result = $db->getstar3($msg_id);
$msg_id= $result[0]["id"];
}
/*exit($msg_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);
}
$msg_id4 = $db->base64url_encode($result[0]["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";
$save="v/uploads/startags/$original";
list($source_width, $source_height, $source_type) = getimagesize($src);
if($source_width >=1500 || $source_height >=2000){
switch ($source_type) {
case IMAGETYPE_GIF:
$image = imagecreatefromgif($src);
break;
case IMAGETYPE_JPEG:
$image = imagecreatefromjpeg($src);
break;
case IMAGETYPE_PNG:
$image = imagecreatefrompng($src);
break;
default:
return false;
}
$max_width = 1500;
$max_height = 2000;
// Get current dimensions
$old_width = imagesx($image);
$old_height = imagesy($image);
// Calculate the scaling we need to do to fit the image inside our frame
$scale = min($max_width/$old_width, $max_height/$old_height);
// Get the new dimensions
$new_width = ceil($scale*$old_width);
$new_height = ceil($scale*$old_height);
// Create new empty image
$new = imagecreatetruecolor($new_width, $new_height);
// Resize old image into new
imagecopyresampled($new, $image,
0, 0, 0, 0,
$new_width, $new_height, $old_width, $old_height);
imagejpeg($new, $save, 100);
}
/* 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);
}
*/
?>
<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: [ 1500, 1500 ],
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"> Crop Photo</h2> </td>
<td align="right">
<?php /*?> <?php $msg_idx = $db->base64url_encode($msg_id); ?>
<?php */?>
<form action="index.php?mode=startags<?php if(!empty($_GET["type"])){?>&type=1<?php }?>" 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_id4 ?>" />
<?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="crop" value="Crop" class="btn-lg btn-info pull-right m-b" style=" margin-top:2px;border:0px;width:105px; margin-right:5px; " />
</form></td>
</tr>
</table>
<div id="preview-pane" style="display:none">
<div class="preview-container">
<img src="" class="jcrop-preview" alt="Preview" />
</div>
</div>
<?php /*?>
<?php echo $picture ?>
<?php */?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center">
<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 />