( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$mag = $_GET["mag"];
$VideoPath = "uploads/live/";
$live_img = 'uploads/images/';
$msg_id2 =$msg_id;
$msg_id = $db->base64url_decode($msg_id);
if($action=="custom") { $script = "processCoke.php"; }
else { $script = "processMag.php";}
$result = $db->getnewsbyidr2($msg_id);
$catalogid = $result[0]["catalogid"];
$yanani= $result[0]["yanani"];
$original= $result[0]["original"];
$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"];
$pic ="v/uploads/raw/$original";
list($w, $h) = getimagesize($pic);
/*if ($w < 100)
{
header("Location: ./indexAlone.php?mode=photos&msg=Your Image is too small. Width should be at least 814px and height of not less than 666px");
exit();}
*/
if ($w > 500)
{
header("Location: ./autosize.php?action=$action&msg_id=$msg_id2&prepare=no");
exit();
}
/*START PROCESS*/
define('MEMORY_TO_ALLOCATE', '100M');
define('DEFAULT_QUALITY', 100);
define('CURRENT_DIR', dirname(__FILE__));
define('CACHE_DIR_NAME', '/v/uploads/raw/');
define('CACHE_DIR', CURRENT_DIR . CACHE_DIR_NAME);
define('DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT']);
if(!empty($mag))
{
$width1=500;
}
else
{
$width1=814;
}
/*$height1=100;*/
/*$cropratio="1.666666666666667:1";*/
$photo="/v/uploads/raw/$original";
$resizedPhoto="v/uploads/raw/$original";
function findSharp($orig, $final) // function from Ryan Rud (http://adryrun.com)
{
$final = $final * (750.0 / $orig);
$a = 52;
$b = -0.27810650887573124;
$c = .00047337278106508946;
$result = $a + $b * $final + $c * $final * $final;
return max(round($result), 0);
} // findSharp()
function doConditionalGet($etag, $lastModified)
{
$if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ?
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) :
false;
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ?
stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) :
false;
if (!$if_modified_since && !$if_none_match)
return;
if ($if_none_match && $if_none_match != $etag && $if_none_match != '"' . $etag . '"')
return; // etag is there but doesn't match
if ($if_modified_since && $if_modified_since != $lastModified)
return; // if-modified-since is there but doesn't match
exit();
} // doConditionalGet()
if (!isset($photo))
{
header("Location: ./index.php?msg=no image was specified");
exit();
}
// Images must be local files, so for convenience we strip the domain if it's there
$image = preg_replace('/^(s?f|ht)tps?:\/\/[^\/]+/i', '', $folder.(string) $photo);
// For security, directories cannot contain ':', images cannot contain '..' or '<', and
// images must start with '/'
if ($image{0} != '/' || strpos(dirname($image), ':') || preg_match('/(\.\.|<|>)/', $image))
{
header("Location: ./index.php?msg=malformed image path. Image paths must begin with");
exit();
}
// If the image doesn't exist, or we haven't been told what it is, there's nothing
// that we can do
if (!$image)
{
header("Location: ./indexAlone.php?mode=photos&msg=no image was specified");
exit();
}
// Strip the possible trailing slash off the document root
$docRoot = preg_replace('/\/$/', '', DOCUMENT_ROOT);
if (!file_exists($docRoot . $image))
{
header("Location: ./indexAlone.php?mode=photos&msg=image does not exist");
exit();
}
// Get the size and MIME type of the requested image
$size = GetImageSize($docRoot . $image);
$mime = $size['mime'];
// Make sure that the requested file is actually an image
if (substr($mime, 0, 6) != 'image/')
{
header("Location: ./indexAlone.php?mode=photos&msg=requested file is not an accepted type");
exit();
}
$width = $size[0];
$height = $size[1];
$maxWidth = (isset($width1)) ? (int) $width1 : 0;
$maxHeight = (isset($height1)) ? (int) $height1 : 0;
if (isset($_GET['color']))
$color = preg_replace('/[^0-9a-fA-F]/', '', (string) $_GET['color']);
else
$color = FALSE;
// If either a max width or max height are not specified, we default to something
// large so the unspecified dimension isn't a constraint on our resized image.
// If neither are specified but the color is, we aren't going to be resizing at
// all, just coloring.
if (!$maxWidth && $maxHeight)
{
$maxWidth = 500;
}
elseif ($maxWidth && !$maxHeight)
{
$maxHeight = 666;
}
elseif ($color && !$maxWidth && !$maxHeight)
{
$maxWidth = $width;
$maxHeight = $height;
}
// If we don't have a max width or max height, OR the image is smaller than both
// we do not want to resize it, so we simply output the original image and exit
if ((!$maxWidth && !$maxHeight) || (!$color && $maxWidth >= $width && $maxHeight >= $height))
{
$data = file_get_contents($docRoot . '/' . $image);
$lastModifiedString = gmdate('D, d M Y H:i:s', filemtime($docRoot . '/' . $image)) . ' GMT';
$etag = $data;
doConditionalGet($etag, $lastModifiedString);
}
else
{
// Ratio cropping
$offsetX = 0;
$offsetY = 0;
if (isset($_GET['cropratio']))
{
$cropRatio = explode(':', (string) $_GET['cropratio']);
if (count($cropRatio) == 2)
{
$ratioComputed = $width / $height;
$cropRatioComputed = (float) $cropRatio[0] / (float) $cropRatio[1];
if ($ratioComputed < $cropRatioComputed)
{ // Image is too tall so we will crop the top and bottom
$origHeight = $height;
$height = $width / $cropRatioComputed;
$offsetY = ($origHeight - $height) / 2;
}
else if ($ratioComputed > $cropRatioComputed)
{ // Image is too wide so we will crop off the left and right sides
$origWidth = $width;
$width = $height * $cropRatioComputed;
$offsetX = ($origWidth - $width) / 2;
}
}
}
// Setting up the ratios needed for resizing. We will compare these below to determine how to
// resize the image (based on height or based on width)
$xRatio = $maxWidth / $width;
$yRatio = $maxHeight / $height;
if ($xRatio * $height < $maxHeight)
{ // Resize the image based on width
$tnHeight = ceil($xRatio * $height);
$tnWidth = $maxWidth;
}
else // Resize the image based on height
{
$tnWidth = ceil($yRatio * $width);
$tnHeight = $maxHeight;
}
// Determine the quality of the output image
$quality = (isset($_GET['quality'])) ? (int) $_GET['quality'] : DEFAULT_QUALITY;
// Before we actually do any crazy resizing of the image, we want to make sure that we
// haven't already done this one at these dimensions. To the cache!
// Note, cache must be world-readable
// We store our cached image filenames as a hash of the dimensions and the original filename
$extfile = explode('/',$image);
$extfile = $extfile[5];
$extfile = explode('.',$extfile);
$imageName = $extfile[0];
switch ($size['mime'])
{
case 'image/gif':
$resizedImage = "$imageName.gif";
break;
case 'image/x-png':
case 'image/png':
$resizedImage = "$imageName.png";
break;
default:
$resizedImage = "$imageName.jpg";
break;
}
$resized = CACHE_DIR . $resizedImage;
$nocache = "yes";
// Check the modified times of the cached file and the original file.
// If the original file is older than the cached file, then we simply serve up the cached file
// We don't want to run out of memory
ini_set('memory_limit', MEMORY_TO_ALLOCATE);
// Set up a blank canvas for our resized image (destination)
$dst = imagecreatetruecolor($tnWidth, $tnHeight);
// Set up the appropriate image handling functions based on the original image's mime type
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
$doSharpen = FALSE;
$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/x-png':
case 'image/png':
$creationFunction = 'ImageCreateFromPng';
$outputFunction = 'ImagePng';
$doSharpen = FALSE;
$quality = round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
break;
default:
$creationFunction = 'ImageCreateFromJpeg';
$outputFunction = 'ImageJpeg';
$doSharpen = FALSE;
break;
}
// Read in the original image
$src = $creationFunction($docRoot . $image);
if (in_array($size['mime'], array('image/gif', 'image/png')))
{
if (!$color)
{
// If this is a GIF or a PNG, we need to set up transparency
imagealphablending($dst, false);
imagesavealpha($dst, 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, hexdec($color[0].$color[1]), hexdec($color[2].$color[3]), hexdec($color[4].$color[5]));
else if (strlen($color) == 3)
$background = imagecolorallocate($dst, hexdec($color[0].$color[0]), hexdec($color[1].$color[1]), hexdec($color[2].$color[2]));
if ($background)
imagefill($dst, 0, 0, $background);
}
}
// Resample the original image into the resized canvas we set up earlier
imagecopyresampled($dst, $src, 0, 0, $offsetX, $offsetY, $tnWidth, $tnHeight, $width, $height);
if ($doSharpen)
{
// Sharpen the image based on two things:
// (1) the difference between the original size and the final size
// (2) the final size
$sharpness = findSharp($width, $tnWidth);
$sharpenMatrix = array(
array(-1, -2, -1),
array(-2, $sharpness + 12, -2),
array(-1, -2, -1)
);
$divisor = $sharpness;
$offset = 0;
imageconvolution($dst, $sharpenMatrix, $divisor, $offset);
}
// Make sure the cache exists. If it doesn't, then create it
if (!file_exists(CACHE_DIR))
mkdir(CACHE_DIR, 0755);
// Make sure we can read and write the cache directory
if (!is_readable(CACHE_DIR))
{
header("Location: ./indexAlone.php?mode=photos&msg=the cache directory is not readable");
exit();
}
else if (!is_writable(CACHE_DIR))
{
header("Location: ./indexAlone.php?mode=photos&msg=the cache directory is not writable");
exit();
}
// Write the resized image to the cache
$outputFunction($dst, $resized, 100);
// Put the data of the resized image into a variable
ob_start();
$outputFunction($dst, null, 100);
$data = ob_get_contents();
ob_end_clean();
// Clean up the memory
ImageDestroy($src);
ImageDestroy($dst);
// See if the browser already has the image
$lastModifiedString = gmdate('D, d M Y H:i:s', filemtime($resized)) . ' GMT';
$etag = $data;
doConditionalGet($etag, $lastModifiedString);
}
list($upana, $urefu) = getimagesize($resizedPhoto);
if ($upana <300)
{
header("Location: ./indexAlone.php?mode=photos&msg=Your photo is too small to edit! ");
exit();}
/*END PROCESS IMAGE*/
?>
<style type="text/css">
.swiper-slide { float:left;
width: 80px;
text-align: left;
line-height: 1.3; margin:2px;
margin-left:5px;
margin-bottom:10px;
}
.swiper-slide img {
width: 80px;
height: 80px;
border-radius: 10px;
box-shadow: 0px 1px 0px #000;
}
.app-title {
font-size: 13px;
font-weight: bold;
text-shadow: 0px 1px 0px #fff;
white-space: nowrap;
text-overflow:ellipsis;
position: relative;
overflow: hidden;
max-width: 90%
}
.app-category {
font-weight: 300;
}
.app-price {
font-weight: bold;
color: #999;
text-shadow: 0px 1px 0px #fff;
}
</style>
<script type="text/javascript">
var msg_id = localStorage.getItem('msg_id');
var picha = localStorage.getItem('picha');
var form = $("#magazine");
$("#photo", form).val("<?php echo $original ?>");
var myaccount= <?php echo $_SESSION['euserid'] ?>;
$('#submitX').css("display","none");
$('#submit').css("display","none");
$("#check").html("Adjusting exposure...");
$("#notify").html("Loading...");
$('#picme').css("opacity","0.00");
$('#picme').css("filter","alpha(opacity=0)");
alert(Server);
$('#preview img').load(function() {}).attr('src', Server+'<?php echo $script ?>?mag=yes&image=<?php echo $original ?>&filter=contrast&nani='+ myaccount);
loading_show();
setTimeout( function(){
$('#submitX').css("display","none");
$('#submit').css("display","block");
$('#picme').css("opacity","1");
$('#picme').css("filter","alpha(opacity=100)");
$("#check").html("");
$("#notify").html("Click on filters to choose effect");
$('#appno').val(AppNo);
loading_hide();
},1500 );
$( document ).ready( function(){
$("#xincrement").click(function(){
var $n = $("#x");
$n.val(Number($n.val()) + 20);
moveIt();
});
$("#xdecrement").click(function(){
var $n = $("#x");
$n.val(Number($n.val()) -20);
moveIt();
});
$("#yincrement").click(function(){
var $n = $("#y");
$n.val(Number($n.val()) + 20);
moveIt();
});
$("#ydecrement").click(function(){
var $n = $("#y");
$n.val(Number($n.val()) -20);
moveIt();
});
//move it
function moveIt() {
loading_show();
$('#submit').css("display","none");
$('#submitX').css("display","none");
var effect = $(this).attr("id");
var image = "<?php echo $original ?>";
var effect= encodeURI(document.getElementById('effecto').value);
var x= encodeURI(document.getElementById('x').value);
var y= encodeURI(document.getElementById('y').value);
var mag= encodeURI(document.getElementById('mag').value);
var myaccount= <?php echo $_SESSION['euserid'] ?>;
;
$("#check").html("Crunching...");
$("#check").html("Applying "+effect+"...");
$("#notify").html("Adjusting | 3secs...");
$('#picme').css("opacity","0.30");
$('#picme').css("filter","alpha(opacity=30)");
$('#preview img').load(function() {
$('p').remove();
}).attr('src', Server+'<?php echo $script ?>?mag=no&AppNo=' + AppNo + '&x=' + x + '&y=' + y + '&image=' + image + '&filter=' + effect+ '&nani='+ myaccount);
setTimeout( function(){
$('#submitX').css("display","none");
$('#submit').css("display","block");
$('#picme').css("opacity","1");
$('#picme').css("filter","alpha(opacity=100)");
$("#check").html("");
$("#notify").html(effect);
$("#notify2").html("Effect:<span class='text-info'>"+effect+"</span>");
loading_hide();
},2500 );
}
//move it
$(function(){
var navSwiper = $('.swiper-nav').swiper({
visibilityFullFit: true,
slidesPerView:'auto',})})
$('.swiper-wrapper').on('click','.swiper-slide',function () {
$('.swiper-slide').removeClass('active-nav');
$(this).addClass('active-nav')
});
});
</script>
<table id="Table_01" width="100%" height="537" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="center" valign="top"><table width="100%" border="0">
<tr>
<td width="348" ><h2 style="margin-top:0px" class="post-title" id="notify2">Effects:<span class='text-info'><?php echo $_GET["action"]; ?></span></h2></td>
<td align="right">
<a id="submit" style="background-color:#F2B601" class="btn-lg btn-danger pull-right " >Apply</a>
<a id="submitX" style="display:none" class="btn-lg btn-info pull-right btn-danger ">Apply</a>
</td>
</tr>
</table>
<table width="100%" border="0" style="margin-top:15px">
<tr>
<td valign="top" width="500" >
<form id="magazine" method="POST">
<input type="hidden" id="mag" name="mag" value="yes" />
<input id="effecto" name="effecto" type="text" value="contrast" autocomplete="off">
</input>
<input id="photo" name="photo" type="hidden" value="">
</input>
<input id="msg_id" name="msg_id" type="hidden" value="<?php echo $msg_id ?>">
</input>
<input type="hidden" id="appno" name="appno" />
<input type="hidden" id="newsid" name="newsid" value="MTQwODY1MTE3Mw,," />
<input type="hidden" id="newsid" name="newsid" value="MTQwODY1MTE3Mw,," />
<input type="hidden" id="step" name="step" value="7" />
<input type="hidden" id="brand" name="brand" value="watermark.png" />
<input id="x" value="0" type="hidden">
<input id="y" value="0" type="hidden">
</form>
<script type="text/javascript">
$(function() {
/* User presses the download button */
/* $('#submit').bind('click',function(){
var dataString = JSON.stringify(data);
$('#jsondata').val(dataString);
$('#jsonform').submit();
});
*/
$("#submit").click(function() {
loading_show();
var effect= encodeURI(document.getElementById('effecto').value);
var image= "<?php echo $original ?>";
var mag= encodeURI(document.getElementById('mag').value);
var x= encodeURI(document.getElementById('x').value);
var y= encodeURI(document.getElementById('y').value);
var newsid= "MTQwODY1MTE3Mw,,";
var myaccount= <?php echo $_SESSION['euserid'] ?>;
$("#check").html("Saving...");
$("#notify").html("Please wait");
$.ajax
({
type: "GET",
url: '<?php echo $script ?>?execute=yes&AppNo=' + AppNo + '&x=' + x + '&y=' + y + '&mag=no&image=' + image + '&action=<?php echo $action; ?>&filter=' + effect+ '&nani='+ myaccount,
data: "page=4",
success: function(msg)
{
loading_hide();
window.location = "indexAlone.php?mode=updateReport&msg_id=<?php echo $msg_id2 ?>";
}
});
/* $('#jsonform5').submit();*/
});
$('.followme').click(function() {
loading_show();
$('#submit').css("display","none");
$('#submitX').css("display","none");
var effect = $(this).attr("id");
var image = "<?php echo $original ?>";
$('#effecto').val(effect);
var x= encodeURI(document.getElementById('x').value);
var y= encodeURI(document.getElementById('y').value);
var mag= encodeURI(document.getElementById('mag').value);
var myaccount= <?php echo $_SESSION['euserid'] ?>;
;
$("#check").html("Crunching...");
$("#check").html("Applying "+effect+"...");
$("#notify").html("Applying | 3secs...");
$('#picme').css("opacity","0.70");
$('#picme').css("filter","alpha(opacity=70)");
$('#preview img').load(function() {
$('p').remove();
}).attr('src', Server+'<?php echo $script ?>?mag=no&AppNo=' + AppNo + '&x=' + x + '&y=' + y + '&image=' + image + '&action=<?php echo $action; ?>&filter=' + effect+ '&nani='+ myaccount+'#<?php rand(1,3);?>');
setTimeout( function(){
$('#submitX').css("display","none");
$('#submit').css("display","block");
$('#picme').css("opacity","1");
$('#picme').css("filter","alpha(opacity=100)");
$("#check").html("");
$("#notify").html(effect);
$("#notify2").html("Effect:<span class='text-info'>"+effect+"</span>");
loading_hide();
},2500 );
});
$('.followps').click(function() {
loading_show();
$('#submitX').css("display","none");
$('#submit').css("display","none");
var effect = $(this).attr("id");
var image = "<?php echo $original ?>";
$('#effecto').val(effect);
var mag= encodeURI(document.getElementById('mag').value);
var myaccount= <?php echo $_SESSION['euserid'] ?>;
$("#check").html("Applying "+effect+"...");
$("#notify").html("Applying | 5secs...");
$('#picme').css("opacity","0.70");
$('#picme').css("filter","alpha(opacity=70)");
$('#preview img').load(function() {
$('p').remove();
}).attr('src', Server+'photoshop.php?mag=no&AppNo=' + AppNo + '&image=' + image + '&action=' + effect+ '&filter=none&nani='+ myaccount+'#<?php rand(1,3);?>');
setTimeout( function(){
$('#submitX').css("display","block");
$('#submit').css("display","none");
$('#picme').css("opacity","1");
$('#picme').css("filter","alpha(opacity=100)");
$("#check").html("");
$("#notify").html(effect);
loading_hide();
},5000 );
});
$("#submitX").click(function() {
loading_show();
var effect= encodeURI(document.getElementById('effecto').value);
var image= "<?php echo $original ?>";
var mag= encodeURI(document.getElementById('mag').value);
var newsid= "MTQwODY1MTE3Mw,,";
var myaccount= <?php echo $_SESSION['euserid'] ?>;
$("#check").html("Saving...");
$("#notify").html("Please wait");
$.ajax
({
type: "GET",
url: Server+'photoshop.php?finish=yes&AppNo=' + AppNo + '&action=' + effect+ '&filter=none&mag=yes&image=' + image + '&filter=' + effect+ '&nani='+ myaccount,
data: "page=4",
success: function(msg)
{
$("#check").ajaxComplete(function(event, request, settings)
{
loading_hide();
window.location = "indexAlone.php?mode=updateReport&msg_id=<?php echo $msg_id2 ?>";
});
}
});
/* $('#jsonform5').submit();*/
});
});
</script>
<div id="preview" class="animated fadeIn" >
<span id="controls">
<div id="yincrement" class="preview_up"></div>
<div id="ydecrement" class="preview_down"></div>
<div id="xincrement" class="preview_left"></div>
<div id="xdecrement" class="preview_right"></div>
</span>
<div class="photo_wrp" style="width:510px">
<img src="" id="picme" style="min-width:480px;border-radius: 10px;">
</div> <div class="badge bg-info pull-none" id="notify" style="margin-top:3px; padding:5px; padding-top:3px; padding-right:7px;padding-left:7px"></div>
</div>
</td>
<td valign="top" align="center" style="padding-left:5px" >
<span id="done2">
<?php
if($action=="filter")
{
include("pages/filters.php");
}
if($action=="auto")
{
include("pages/auto.php");
}
if($action=="sticker")
{
include("pages/sticker.php");
}
if($action=="frame")
{
include("pages/frame.php");
}
if($action=="meme")
{
include("pages/meme.php");
}
if($action=="custom")
{
include("pages/custom.php");
}
?> </span>
</td>
</tr>
</table>
</td>
</tr>
</table>