File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 9
9
10
10
class FileApi
11
11
{
12
+ const SIZE_ORIGINAL = null ;
13
+ const SIZE_LARGE = 'L ' ;
14
+ const SIZE_MEDIUM = 'M ' ;
15
+ const SIZE_SMALL = 'S ' ;
16
+
12
17
protected $ basepath ;
13
18
protected $ default_sizes = ['S ' => '96x96 ' , 'M ' => '256x256 ' , 'L ' => '480x480 ' ];
14
19
protected $ thumb_sizes = null ;
@@ -28,7 +33,7 @@ public function __construct($basepath = DIRECTORY_SEPARATOR)
28
33
$ this ->basepath = $ basepath ;
29
34
}
30
35
31
- public function get ($ filename , $ size = null )
36
+ public function get ($ filename , $ size = self :: SIZE_LARGE )
32
37
{
33
38
if (empty ($ filename )) {
34
39
return '' ;
@@ -40,13 +45,12 @@ public function get($filename, $size = null)
40
45
if (empty ($ filename )) {
41
46
return '' ;
42
47
}
43
-
44
- if (empty ($ size ) && \Storage::exists ($ this ->basepath . $ file [0 ] . '_L. ' . $ file [1 ])) {
45
- $ file_path = $ this ->basepath . $ file [0 ] . '_L. ' . $ file [1 ];
46
- } elseif (\Storage::exists ($ this ->basepath . $ file [0 ] . '_ ' . $ size . '. ' . $ file [1 ])) {
48
+
49
+ $ file_path = $ this ->basepath . $ filename ;
50
+
51
+ if ($ size != self ::SIZE_ORIGINAL
52
+ && \Storage::exists ($ this ->basepath . $ file [0 ] . '_ ' . $ size . '. ' . $ file [1 ])) {
47
53
$ file_path = $ this ->basepath . $ file [0 ] . '_ ' . $ size . '. ' . $ file [1 ];
48
- } else {
49
- $ file_path = $ this ->basepath . $ filename ;
50
54
}
51
55
52
56
if (\Config::get ('filesystems.default ' ) == 's3 ' ) {
You can’t perform that action at this time.
0 commit comments