| Server IP : 208.122.213.31 / Your IP : 216.73.216.185 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/store.tiacyrusxxx.com/public_html/dev/xfcadmin/ |
Upload File : |
<?php
include_once ("adm.config.php");
//if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['id']) && $_POST['id'] != "" && isset($_POST['x']) && is_numeric($_POST['x']) && isset($_POST['y']) && is_numeric($_POST['y']) && isset($_POST['w']) && is_numeric($_POST['w']) && isset($_POST['h']) && is_numeric($_POST['h']) && isset($_POST['iid']) && $_POST['iid'] != "" && isset($_POST['ct']) && $_POST['ct'] != "") {
/*
echo $_POST['id'] . "<br />";
echo $_POST['x'] . "<br />";
echo $_POST['y'] . "<br />";
echo $_POST['w'] . "<br />";
echo $_POST['h'] . "<br />";
echo $_POST['iid'] . "<br />";
echo $_POST['ct'] . "<br />";
die();
*/
$ct = $_POST['ct'];
$itemID = $_POST['iid'];
$content_id = $_POST['id'];
if ($userDetails -> xfcadmin == 9) {
$sqlAdd = "";
} else {
$sqlAdd = " AND model_id = '" . $userDetails -> model_id . "'";
}
$get_sql = mysql_query("SELECT content_id, content_type, directory FROM cms_content WHERE content_type = '1' AND content_id = '" . $content_id . "'" . $sqlAdd) or die(mysql_error());
if (mysql_num_rows($get_sql) == 0) {
die("<br /><br />error 1<br /><br />");
}
$contentInfo = mysql_fetch_object($get_sql);
$getImage_sql = mysql_query("SELECT * FROM cms_content_items WHERE content_id = '" . $content_id . "' AND itemID = '" . $itemID . "'") or die(mysql_error());
if (mysql_num_rows($getImage_sql) == 0) {
die("<br /><br />error 2<br /><br />");
}
if($ct == "tn") {
$cropWidth = $imageSizesPhotosetTN_x;
$cropHeight = $imageSizesPhotosetTN_y;
} elseif ($ct == "main") {
$cropWidth = $imageSizesPhotosetMain_x;
$cropHeight = $imageSizesPhotosetMain_y;
}
$image = mysql_fetch_object($getImage_sql);
$getImage = $contentPath . $contentInfo->directory . "/" . $image->filename;
$imageCrop_w = round($_POST['w']);
$imageCrop_h = round($_POST['h']);
$imageCrop_x = $_POST['x'];
$imageCrop_y = $_POST['y'];
$imageCrop = imagecreatefromjpeg($getImage);
$imageNew = ImageCreateTrueColor($cropWidth,$cropHeight);
imagecopyresampled($imageNew, $imageCrop, 0, 0, $imageCrop_x, $imageCrop_y, $cropWidth, $cropHeight, $imageCrop_w, $imageCrop_h);
imagejpeg($imageNew, $contentPathFree.$contentInfo->directory.'/' . $ct . '.jpg', 90);
imagedestroy($imageCrop);
imagedestroy($imageNew);
//echo '<img src="../../'.$webPathFree .$contentInfo->directory .'/'.$ct.'.jpg">';
//die();
printf("<meta http-equiv=\"Refresh\" content=\"0;url=./adm.content.modify.php?id=".$content_id."\">");
exit;
}
if (!isset($_GET['id']) && !is_numeric($_GET['id'])) {
die("<br /><br />error 1<br /><br />");
}
if (isset($_GET['ct'])) {
$ct = $_GET['ct'];
} else {
die("<br /><br />error 2<br /><br />");
}
if (isset($_GET['iid'])) {
$itemID = $_GET['iid'];
} else {
die("<br /><br />error 3<br /><br />");
}
$content_id = addslashes($_GET['id']);
if ($userDetails -> xfcadmin == 9) {
$sqlAdd = "";
} else {
$sqlAdd = " AND model_id = '" . $userDetails -> model_id . "'";
}
$get_sql = mysql_query("SELECT content_id, content_type, directory FROM cms_content WHERE content_type = '1' AND content_id = '" . $content_id . "'" . $sqlAdd) or die(mysql_error());
if (mysql_num_rows($get_sql) == 0) {
die("<br /><br />error 4<br /><br />");
}
$contentInfo = mysql_fetch_object($get_sql);
$getImage_sql = mysql_query("SELECT * FROM cms_content_items WHERE content_id = '" . $content_id . "' AND itemID = '" . $itemID . "'") or die(mysql_error());
if (mysql_num_rows($getImage_sql) == 0) {
die("<br /><br />error 5<br /><br />");
}
if($ct == "tn") {
$cropWidth = $imageSizesPhotosetTN_x;
$cropHeight = $imageSizesPhotosetTN_y;
} elseif ($ct == "main") {
$cropWidth = $imageSizesPhotosetMain_x;
$cropHeight = $imageSizesPhotosetMain_y;
}
$image = mysql_fetch_object($getImage_sql);
$getImage = $contentInfo->directory . "/" . $image->filename;
$secureImage = secureFile($getImage);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Live Cropping Demo</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="css/jquery.Jcrop.css" type="text/css" />
<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]);
$('#target').Jcrop({
onChange: updatePreview,
onSelect: updatePreview,
aspectRatio: xsize / ysize
},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 updatePreview(c)
{
if (parseInt(c.w) > 0)
{
var rx = xsize / c.w;
var ry = ysize / c.h;
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(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>
<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: -<?php echo ($cropWidth+50); ?>px;
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: <?php echo $cropWidth; ?>px;
height: <?php echo $cropHeight; ?>px;
overflow: hidden;
}
</style>
</head>
<body>
<!-- This is the image we're attaching Jcrop to -->
<img src="<?php echo $secureImage; ?>" <?php /* width="400" NEED TO WRITE OUT SCALING */ ?> id="target" />
<div id="preview-pane">
<div class="preview-container">
<img src="<?php echo $secureImage; ?>" class="jcrop-preview" alt="Preview" />
</div>
</div>
<!-- This is the form that our event handler fills -->
<form action="adm.crop.php" method="post" onsubmit="return checkCoords();">
<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="h" name="h" />
<input type="hidden" name="id" value="<?php echo $content_id; ?>">
<input type="hidden" name="ct" value="<?php echo $ct; ?>">
<input type="hidden" name="iid" value="<?php echo $itemID; ?>">
<input type="submit" value="Crop Image" class="btn btn-large btn-inverse" />
</form>
</body>
</html>