$height = $resized[1]; $temp = basename($resized[2]); $WPRO_SESS->data['imageEditor'][$editorID]['temp'] = $temp; $response->addScriptCall('editFinished', $file, $temp, $width, $height, true); //$WPRO_SESS->save(); $WPRO_SESS->doSave = true; $response->addScriptCall("dialog.hideLoadMessage", ''); return $response; } else { array_push($failed, $file); } } } else { if ($task == 'resize') { if (!empty($options['width']) && !empty($options['height']) && is_numeric($options['width']) && is_numeric($options['height'])) { if ($resized = $im->proportionalResize($directory . $imageToEdit, $directory . $temp, intval($options['width']), intval($options['height']))) { $width = $resized[0]; $height = $resized[1]; $temp = basename($resized[2]); $WPRO_SESS->data['imageEditor'][$editorID]['temp'] = $temp; $response->addScriptCall('editFinished', $file, $temp, $width, $height, true); //$WPRO_SESS->save(); $WPRO_SESS->doSave = true; $response->addScriptCall("dialog.hideLoadMessage", ''); return $response; } else { array_push($failed, $file); } } else { array_push($failed, $file); }
if (!@move_uploaded_file($_FILES[$field]['tmp_name'][$i], $folder . $name)) { // failed to move file $errors['fatal'][$_FILES[$field]['name'][$i]] = 'unknown'; @unlink($_FILES[$field]['tmp_name'][$i]); if ($stopOnError) { return $errors; } } else { // if image check size... if ($chkimgwidth) { if (in_array($extension, $GDExtensions)) { list($width, $height) = @getimagesize($folder . $name); if ($width > $maxwidth || $height > $maxheight) { // image too large // if GD library is installed re-size image to maximum acceptable size... if ($resizedTo = @$imageEditor->proportionalResize($folder . $name, $folder . $name, $maxwidth, $maxheight)) { $errors['resized'][$_FILES[$field]['name'][$i]] = $resizedTo; $name = basename($resizedTo[2]); if (isset($errors['overwrite'][$_FILES[$field]['name'][$i]])) { if ($errors['overwrite'][$_FILES[$field]['name'][$i]] != $name) { unset($errors['overwrite'][$_FILES[$field]['name'][$i]]); if (file_exists($folder . $name) && !$overwrite) { $errors['overwrite'][$goodName . '.png'] = basename($resizedTo[2]); } else { $this->rename($folder . basename($resizedTo[2]), $folder . $goodName . '.png'); } } } } else { $errors['fatal'][$_FILES[$field]['name'][$i]] = 'badDimensions'; @unlink($folder . $name);
$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); } } }
} else { // if dir is writable create a thumbnail cache folder and store thumbnails there. if ($dirWritable && $thumbDirExists) { // create thumbnail folder if there are images to display //if ($thumbDirExists) { $thumbDir = $directory . $EDITOR->thumbnailFolderName . '/' . $filename; $thumbURL = $url . $EDITOR->thumbnailFolderName . '/' . $filename; // create and store thumbnail if (is_file($thumbDir)) { $thumb_src = $thumbURL; $thumbCreated = true; } elseif (is_file($thumbDir . '.png')) { $thumb_src = $thumbURL . '.png'; $thumbCreated = true; } elseif ($limit < $thumbLimit && $failed < $failLimit && ($extension == '.gif' && $canGif || $extension != '.gif')) { if ($thumbDimensions = @$imageEditor->proportionalResize($directory . $filename, $thumbDir, 94, 94)) { list($thumb_width, $thumb_height, $thumb_src) = $thumbDimensions; $thumb_src = $url . $EDITOR->thumbnailFolderName . strrchr($thumb_src, '/'); //exit($thumb_src); $thumbCreated = true; $limit++; } } } } // thumbnail could not be created... if (!$thumbCreated) { // the dir is not writable so we cannot cache the thumbnails, but we will create a dynamic thumbnail... // create dynamic thumbnail // work out if we can create a thumbnail if ($extension == '.gif' && $canGif || $extension != '.gif') {