A
Anonymous
Guest
Hey guy's i have this script that works great but only thing is it does not remove the old file?
i think the quality is compromised?could it be?
i think the quality is compromised?could it be?
Code:
session_start();
include_once 'dbconnect.php';
if (!isset($_SESSION['userSession'])) {
header("Location: index.php");
}
$degrees = -270;
$path = $_GET['Folder'];
$file =$_GET['Pic'];
$fileid =$_GET['id'];
$image = $path.'/'.$file;
$imageN = $path.'/New_'.$file;
$source = imagecreatefromjpeg($image);
$rotate = imagerotate($source, $degrees, 0);
$NewImg='New_'.$file ;
imagejpeg($rotate,$imageN);
imagedestroy($source);
imagedestroy($rotate);
$sql = "UPDATE Coupon_list SET product_image_thumb = '$NewImg' WHERE id = '$fileid'";
if (mysqli_query($DBcon, $sql)) {
echo "Rotation ok";
echo('<script language="Javascript">opener.window.location.reload(false); window.close();</script>');
} else {
echo "Error Rotating: " . mysqli_error($DBcon);
echo "<meta http-equiv=Refresh content=2;url=Coupons.php?>";
}
mysqli_close($DBcon);
?>
<img src='<?php echo $image;?>' ></br>
<img src='<?php echo $imageN;?>'>