/** * Dipsplay image for resizing * * @return mixed */ public function getResize() { $ratio = 1.0; $image = Input::get('img'); $path_to_image = parent::getPath('directory') . $image; $original_width = Image::make($path_to_image)->width(); $original_height = Image::make($path_to_image)->height(); $scaled = false; if ($original_width > 600) { $ratio = 600 / $original_width; $width = $original_width * $ratio; $height = $original_height * $ratio; $scaled = true; } else { $width = $original_width; $height = $original_height; } if ($height > 400) { $ratio = 400 / $original_height; $width = $original_width * $ratio; $height = $original_height * $ratio; $scaled = true; } return View::make('laravel-filemanager::resize')->with('img', parent::getUrl('directory') . $image)->with('imgName', $image)->with('height', number_format($height, 0))->with('width', $width)->with('original_height', $original_height)->with('original_width', $original_width)->with('scaled', $scaled)->with('ratio', $ratio); }
/** * Show crop page * * @return mixed */ public function getCrop() { $working_dir = Input::get('working_dir'); $img = parent::getUrl('directory') . Input::get('img'); $imgName = Input::get('img'); return View::make('laravel-filemanager::crop')->with(compact('working_dir', 'img', 'imgName')); }
/** * Get the images to load for a selected folder * * @return mixed */ public function getItems() { $type = Input::get('type'); $view = $this->getView(); $path = parent::getPath(); $files = File::files($path); $file_info = $this->getFileInfos($files, $type); $directories = parent::getDirectories($path); $thumb_url = parent::getUrl('thumb'); return view($view)->with(compact('type', 'file_info', 'directories', 'thumb_url')); }
private function useFile($new_filename) { $file = parent::getUrl() . $new_filename; return "<script type='text/javascript'>\n\n function getUrlParam(paramName) {\n var reParam = new RegExp('(?:[\\?&]|&)' + paramName + '=([^&]+)', 'i');\n var match = window.location.search.match(reParam);\n return ( match && match.length > 1 ) ? match[1] : null;\n }\n\n var funcNum = getUrlParam('CKEditorFuncNum');\n\n var par = window.parent,\n op = window.opener,\n o = (par && par.CKEDITOR) ? par : ((op && op.CKEDITOR) ? op : false);\n\n if (op) window.close();\n if (o !== false) o.CKEDITOR.tools.callFunction(funcNum, '{$file}');\n </script>"; }