FEATURE: add ViewerJS to preview pdf and odf files in file manager
This commit is contained in:
@@ -96,7 +96,6 @@ class FileManager
|
||||
return '<img src="' . $url . '" alt="' . $file->description . '" />';
|
||||
break;
|
||||
case 'text':
|
||||
|
||||
$string = '<pre><code>';
|
||||
$string .= htmlspecialchars(file_get_contents($path));
|
||||
$string .= '</pre></code>';
|
||||
@@ -104,15 +103,8 @@ class FileManager
|
||||
return $string;
|
||||
break;
|
||||
case 'application':
|
||||
switch ($subtype) {
|
||||
case 'pdf':
|
||||
return '<i class="fa fa-file-pdf-o"></i>';
|
||||
break;
|
||||
default:
|
||||
return '<i class="fa fa-newspaper-o"></i>';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
return '<iframe src = "'.asset('resources/assets/admin/js/viewerJs/').'/#'.Template::upload($file->filename).'" style="width: 100%; height: 50em" allowfullscreen webkitallowfullscreen></iframe>';
|
||||
break;
|
||||
default:
|
||||
return self::getPreview($file);
|
||||
break;
|
||||
@@ -132,19 +124,12 @@ class FileManager
|
||||
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
|
||||
return [
|
||||
trans('admin/fileManager.encoding') => mb_detect_encoding(file_get_contents($path))
|
||||
];
|
||||
return [trans('admin/fileManager.encoding') => mb_detect_encoding(file_get_contents($path))];
|
||||
break;
|
||||
|
||||
case 'image':
|
||||
list ($width, $height) = getimagesize($path);
|
||||
|
||||
return [
|
||||
trans('admin/fileManager.resolution') => $height . ' x ' . $width,
|
||||
];
|
||||
|
||||
return [trans('admin/fileManager.resolution') => $height . ' x ' . $width,];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user