<?php /* For licensing terms, see /license.txt */ /** * ajax preview * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @link www.phpletter.com * @since 22/April/2007 * */ require_once '../../../../../../inc/global.inc.php'; require_once api_get_path(LIBRARY_PATH) . 'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php'; $path = base64_decode($_GET['path']); if (!empty($path) && file_exists($path) && is_file($path)) { require_once CLASS_IMAGE; $image = new ImageAjaxFileManager(true); if ($image->loadImage($path)) { if ($image->resize(CONFIG_IMG_THUMBNAIL_MAX_X, CONFIG_IMG_THUMBNAIL_MAX_Y, true, true)) { $image->showImage(); } else { echo PREVIEW_NOT_PREVIEW . "."; } } else { echo PREVIEW_NOT_PREVIEW . ".."; } } else { echo PREVIEW_NOT_PREVIEW . "..."; }
$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 ImageAjaxFileManager(); $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']))) {