private function getImageEditorInfo() { $path = $this->getPath(); $file = isset($this->request->file) ? $this->request->file : ''; $box = isset($this->request->box) ? (object) $this->request->box : ''; $newname = !empty($this->request->newname) ? $this->makeSafe($this->request->newname) : ''; if (!$path || !file_exists($path . $file)) { trigger_error('Image file is not specified', E_USER_WARNING); } $img = new abeautifulsite\SimpleImage(); try { $img->load($path . $file); } catch (Exception $e) { trigger_error($e->getMessage(), E_USER_WARNING); } if ($newname) { $info = pathinfo($path . $file); $newname = $newname . '.' . $info['extension']; if (file_exists($path . $newname)) { trigger_error('File ' . $newname . ' already exists', E_USER_WARNING); } } else { $newname = $file; } if (file_exists($path . $this->config->thumbFolderName . DIRECTORY_SEPARATOR . $newname)) { unlink($path . $this->config->thumbFolderName . DIRECTORY_SEPARATOR . $newname); } $info = $img->get_original_info(); return (object) array('path' => $path, 'file' => $file, 'box' => $box, 'newname' => $newname, 'img' => $img, 'width' => $info['width'], 'height' => $info['height']); }