public function fileInfo($get) { $uri = $get['f']; $repo = Repository::findOneByPk($get['id']); $path = $this->getPath($repo); $f = $path . $get['f']; if (!is_file($f)) { return array(); } $content = file_get_contents($f); $type = array_last(explode('.', $f)); $name = basename($f); return array('uri' => $uri, 'type' => $type, 'name' => $name, 'is_image' => self::isImage($type), 'content' => !self::isImage($type) ? $content : base64_encode($content), 'comments' => self::getComments($uri)); }
<?php /** * Created by PhpStorm. * User: Sasumi * Date: 2015/11/2 * Time: 11:37 */ use Lite\Core\Config; use function Lite\func\array_last; use function Lite\func\dump; return array('path' => Config::get('app/root') . 'public/upload/', 'url' => Config::get('app/url') . 'upload/', 'file_name_converter' => function ($file_name) { $ext = array_last(explode('.', $file_name)); return md5($file_name) . '.' . $ext; }, 'max_size' => 50000000000.0, 'file_type' => 'jpg,png,jpeg,doc,txt,pdf');