Skip to content

Commit 85ff6c2

Browse files
author
steve-ks
committed
Update storage view and add responsive display
* Add general responsive layout * Add image preview in storage blade
1 parent 1e16a9f commit 85ff6c2

23 files changed

+9447
-37
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/node_modules
22
/public/hot
33
/public/storage
4-
/public/webfonts
54
/storage/*.key
65
/vendor
76
.env

app/Http/Controllers/StorageController.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class StorageController extends Controller
2121
'excel' => 'file-excel',
2222
'file' => 'file',
2323
'folder' => 'folder',
24+
'image' => 'file-image',
2425
'pdf' => 'file-pdf',
2526
'powerpoint' => 'file-powerpoint',
2627
'text' => 'file-alt',
@@ -52,6 +53,13 @@ private function selectMimeIcon($mime)
5253
}
5354
}
5455

56+
// For images with missing thumbnails
57+
if ($this->startsWith($mime, 'image'))
58+
{
59+
return $this->faMimeIcons['image'];
60+
}
61+
62+
5563
if ($this->startsWith($mime, 'application'))
5664
{
5765
if ($this->contains($mime, 'word') || $this->contains($mime, 'text'))
@@ -93,12 +101,14 @@ public function index(String $dir)
93101
Storage::disk('public')->url(File::dirname($file) . "/thumbs/" . File::basename($file)) :
94102
null;
95103

104+
$mime = Storage::disk('public')->mimeType($file);
96105
array_push($files, [
97-
'basename' => $basename,
98-
'image' => $image,
99-
'icon' => $image == null ? $this->selectMimeIcon(Storage::disk('public')->mimeType($file)) : null,
100-
'url' => Storage::disk('public')->url($file),
101-
'mime' => Storage::disk('public')->mimeType($file)
106+
'basename' => $basename,
107+
'image' => $image,
108+
'icon' => $image == null ? $this->selectMimeIcon(Storage::disk('public')->mimeType($file)) : null,
109+
'url' => Storage::disk('public')->url($file),
110+
'mime' => $mime,
111+
'ispicture' => $this->startsWith($mime, 'image'),
102112
]);
103113
}
104114

app/Http/Controllers/UploadController.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Http\Request;
99
use Illuminate\Support\Facades\File;
1010
use Illuminate\Support\Facades\Storage;
11+
use Intervention\Image\Exception\NotReadableException;
1112
use Intervention\Image\Facades\Image;
1213

1314
class UploadController extends Controller
@@ -36,11 +37,16 @@ public function createThumbs($publicPath)
3637

3738
if ($this->startsWith($mime, "image") && !Storage::disk('public')->exists($thumbPath . "/" . $name))
3839
{
39-
// Create thumb of image and store beside it
40-
Image::make($path)
41-
->widen (300, function($constraint) { $constraint->upsize(); })
42-
->heighten(300, function($constraint) { $constraint->upsize(); })
43-
->save(File::dirname($path) . "/thumbs/" . $name);
40+
try {
41+
// Create thumb of image and store beside it
42+
Image::make($path)
43+
->widen (300, function($constraint) { $constraint->upsize(); })
44+
->heighten(300, function($constraint) { $constraint->upsize(); })
45+
->save(File::dirname($path) . "/thumbs/" . $name);
46+
} catch (NotReadableException $e) {
47+
// Skip file
48+
continue;
49+
}
4450
}
4551
}
4652

public/css/app.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/webfonts/fa-brands-400.eot

130 KB
Binary file not shown.

public/webfonts/fa-brands-400.svg

Lines changed: 3570 additions & 0 deletions
Loading

public/webfonts/fa-brands-400.ttf

130 KB
Binary file not shown.

public/webfonts/fa-brands-400.woff

87.7 KB
Binary file not shown.
74.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)