From 2028c7ad90838b1a61ea12b9bb50d7a7bfcaf62b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 25 Jul 2011 18:45:59 +0200 Subject: [PATCH] Fixing ajaxfilemanager thumb generation see #3710 (Renaming the Image class to ImageAjaxFileManager) --- .../ajaxfilemanager/ajax_editor_reset.php | 2 +- .../ajaxfilemanager/ajax_image_editor.php | 2 +- .../ajaxfilemanager/ajax_image_save.php | 2 +- .../ajaxfilemanager/ajax_image_thumbnail.php | 53 ++++++++----------- .../ajaxfilemanager/ajax_image_undo.php | 2 +- .../ajaxfilemanager/inc/class.image.php | 25 ++++----- .../plugins/ajaxfilemanager/inc/config.php | 10 ++-- 7 files changed, 43 insertions(+), 53 deletions(-) diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php index 1cba8ca2ea..77358c5b1e 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_editor_reset.php @@ -41,7 +41,7 @@ { include_once(CLASS_IMAGE); - $image = new Image(); + $image = new ImageAjaxFileManager(); $image->loadImage($_POST['path']); switch($_POST['mode']) diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php index 0ad9cf566f..2a33ae7676 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_editor.php @@ -32,7 +32,7 @@ } } require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "class.image.php"); - $image = new Image(); + $image = new ImageAjaxFileManager(); $imageInfo = $image->getImageInfo($path); diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php index bb94d6bbf9..c905c2bb24 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_save.php @@ -50,7 +50,7 @@ } include_once(CLASS_IMAGE); - $image = new Image(); + $image = new ImageAjaxFileManager(); if($image->loadImage($originalImage)) { diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php index c6357a9d11..4e324f17df 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_thumbnail.php @@ -1,33 +1,24 @@ loadImage($_GET['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 . ".."; +/** + * ajax preview + * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) + * @link www.phpletter.com + * @since 22/April/2007 + * + */ +include_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"); +if(!empty($_GET['path']) && file_exists($_GET['path']) && is_file($_GET['path'])) { + require_once CLASS_IMAGE; + $image = new ImageAjaxFileManager(true); + if($image->loadImage($_GET['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 . ".."; + } +} else { + echo PREVIEW_NOT_PREVIEW . "..."; +} \ No newline at end of file diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php index 6f2076e5be..68a83f93bf 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajax_image_undo.php @@ -44,7 +44,7 @@ } include_once(CLASS_IMAGE); - $image = new Image(); + $image = new ImageAjaxFileManager(); if($image->loadImage($sessionImage)) { $imageInfo = $image->getOriginalImageInfo(); diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php index 1265e6c012..ffe6e59c3e 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.image.php @@ -1,19 +1,16 @@ BeezNest 2011 Fixing bugs + * * @since 31/December/2008 */ @@ -21,8 +23,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php"); define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration - if(!headers_sent()) - { + if(!headers_sent()) { header('Content-Type: text/html; charset=utf-8'); } @@ -91,6 +92,7 @@ } } addNoCacheHeaders(); + $web_path = api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/plugins/ajaxfilemanager/'; //URL Declartions define('CONFIG_URL_IMAGE_PREVIEW', 'ajax_image_preview.php'); define('CONFIG_URL_CREATE_FOLDER', 'ajax_create_folder.php'); @@ -112,7 +114,7 @@ define('CONFIG_URL_GET_FOLDER_LIST', 'ajax_get_folder_listing.php'); define('CONFIG_URL_SAVE_TEXT', 'ajax_save_text.php'); define('CONFIG_URL_LIST_LISTING', 'ajax_get_file_listing.php'); - define('CONFIG_URL_IMG_THUMBNAIL', 'ajax_image_thumbnail.php'); + define('CONFIG_URL_IMG_THUMBNAIL', $web_path.'ajax_image_thumbnail.php'); define('CONFIG_URL_FILEnIMAGE_MANAGER', 'ajaxfilemanager.php'); define('CONFIG_URL_FILE_PASTE', 'ajax_file_paste.php');