if (!defined('IN_WPRO')) {
    exit;
}
global $EDITOR, $DIALOG, $WPRO_SESS;
//if (!$response) {
$response = $DIALOG->createAjaxResponse();
//}
// initial var check...
if (!isset($folderId, $folderPath, $editorID, $task) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($editorID) || !is_string($task)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("dialog.hideLoadMessage", '');
    return $response;
}
$fs = new wproFilesystem();
require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
$im = new wproImageEditor();
$failed = array();
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->editImages) {
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSEditPermissionsError'));
        $response->addScriptCall("dialog.close", '');
        $response->addScriptCall("dialog.hideLoadMessage", '');
        return $response;
    }
    if (isset($WPRO_SESS->data['imageEditor'])) {
        /*ob_start();
        		echo $editorID;
        		print_r($WPRO_SESS->data['imageEditor']);
Beispiel #2
0
// an array of files that failed to upload
$errors['resized'] = array();
// images resized to maximum allowed size
$errors['renamed'] = array();
// an array of files which had to be slightly re-named
$errors['overwrite'] = array();
// an array of files where a file with that name already exists
$errors['succeeded'] = array();
// array of files successfully uploaded, if files were renamed this has the renamed name not the original.
$GDExtensions = array('.jpg', '.jpeg', '.gif', '.png');
// filetypes that can be resized with GD
if (substr($folder, strlen($folder) - 1) != '/') {
    $folder .= '/';
}
require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
$imageEditor = new wproImageEditor();
if (isset($_FILES[$field])) {
    $num = count($_FILES[$field]['tmp_name']);
    for ($i = 0; $i <= $num - 1; $i++) {
        if (is_uploaded_file($_FILES[$field]['tmp_name'][$i])) {
            if (empty($_FILES[$field]['name'][$i])) {
                continue;
            }
            $extension = strrchr(strtolower($_FILES[$field]['name'][$i]), '.');
            // check filetype against accepted files
            if (!$this->extensionOK($extension, $extensions)) {
                // bad extension...
                $errors['fatal'][$_FILES[$field]['name'][$i]] = 'badExtension';
                @unlink($_FILES[$field]['tmp_name'][$i]);
                if ($stopOnError) {
                    return $errors;
Beispiel #3
0
 $file = $params['file'];
 $fs = new wproFilesystem();
 if ($fs->fileNameOK($file)) {
     if (is_file($directory . $file)) {
         // if the thumbnail folder exists & is  writable lets cache the thumbnail
         if (file_exists($directory . $EDITOR->thumbnailFolderName) && $fs->fileNameOk($EDITOR->thumbnailFolderName) && is_writable($directory . $EDITOR->thumbnailFolderName)) {
             $savePath = $directory . $EDITOR->thumbnailFolderName . '/' . $file;
             // do not create if it already exists
             if (is_file($savePath)) {
                 $savePath = '';
             }
         } else {
             $savePath = '';
         }
         require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
         $imageEditor = new wproImageEditor();
         if (!$imageEditor->proportionalResize($directory . $file, '', 94, 94)) {
             $extension = strrchr(strtolower($file), '.');
             $GDExtensions = array('.jpg', '.jpeg', '.gif', '.png');
             // filetypes that can be resized with GD
             if (in_array($extension, $GDExtensions)) {
                 $icon = str_replace('.', '', $extension);
                 $thumb_src = $EDITOR->themeFolderURL . $EDITOR->theme . "/wysiwygpro/icons/{$icon}32.gif";
                 header('Location: ' . $thumb_src);
             }
         } else {
             if (!empty($savePath)) {
                 // cache the thumbnail
                 $imageEditor->proportionalResize($directory . $file, $savePath, 94, 94);
             }
         }
     //if (!(imagetypes() & IMG_PNG)) return false;
     //$canJpeg = function_exists("imagejpeg") ? true : false;
     //$canPng = function_exists("imagepng") ? true : false;
     if (!function_exists('imagegif') && (!function_exists('imagecreatefromgif') || !function_exists('imagepng'))) {
         $canGif = false;
     } else {
         $canGif = true;
     }
 } else {
     return false;
 }
 $GDExtensions = array('.jpg', '.jpeg', '.gif', '.png');
 // filetypes that can be resized with GD
 $fs = new wproFilesystem();
 require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
 $imageEditor = new wproImageEditor();
 //$imageEditor->adjustMemoryLimit = false; // we want to prevent time outs so we won't create thumbnails on huge images.
 $imageEditor->fileCHMOD = $EDITOR->fileCHMOD;
 // mode for new thumbnails
 // initiate variables
 $dirWritable = is_writable($directory);
 $thumb_src = '';
 $thumbDirExists = false;
 // create thumb cache folder
 if (file_exists($directory . $EDITOR->thumbnailFolderName) && $fs->fileNameOk($EDITOR->thumbnailFolderName)) {
     //$thumbDirCreated = true;
     $thumbDirExists = true;
 } else {
     // create thumb cache dir
     if (count($files) && $dirWritable && !strstr($url, $EDITOR->thumbnailFolderName) && $fs->fileNameOk($EDITOR->thumbnailFolderName)) {
         if (!$fs->makeDir($directory . $EDITOR->thumbnailFolderName, $EDITOR->folderCHMOD)) {