<?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 . "...";
}
예제 #2
0
    $error = IMG_SAVE_PATH_DISALLOWED;
} else {
    if (!sizeof($lastestSessionImageInfo)) {
        $error = IMG_UNDO_NO_HISTORY_AVAIALBE;
    } else {
        //get the original image which is the lastest session image if any when the system is in demo
        $sessionImage = $session->getSessionDir() . $lastestSessionImageInfo['name'];
        $originalSessionImageInfo = $history->getOriginalImage();
        if (CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo)) {
            $originalImage = $session->getSessionDir() . $originalSessionImageInfo['info']['name'];
        } else {
            $originalImage = $_POST['file_path'];
        }
        include_once CLASS_IMAGE;
        $image = new ImageAjaxFileManager();
        if ($image->loadImage($sessionImage)) {
            $imageInfo = $image->getOriginalImageInfo();
            if (!@copy($sessionImage, $originalImage)) {
                $error = IMG_UNDO_COPY_FAILED;
            } else {
                //remove the session image
                if (@unlink($sessionImage)) {
                    $history->restore();
                }
                //only one left, remove the session original if demo
                if ($history->getNumRestorable() == 0 && CONFIG_SYS_DEMO_ENABLE && sizeof($originalSessionImageInfo)) {
                    @unlink($session->getSessionDir() . $originalSessionImageInfo['info']['name']);
                    $originalImage = $_POST['file_path'];
                }
            }
            $imagePath = $originalImage;
예제 #3
0
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 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;
                    }