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 99
1010class FileApi
1111{
12+ const SIZE_ORIGINAL = null ;
13+ const SIZE_LARGE = 'L ' ;
14+ const SIZE_MEDIUM = 'M ' ;
15+ const SIZE_SMALL = 'S ' ;
16+
1217 protected $ basepath ;
1318 protected $ default_sizes = ['S ' => '96x96 ' , 'M ' => '256x256 ' , 'L ' => '480x480 ' ];
1419 protected $ thumb_sizes = null ;
@@ -28,7 +33,7 @@ public function __construct($basepath = DIRECTORY_SEPARATOR)
2833 $ this ->basepath = $ basepath ;
2934 }
3035
31- public function get ($ filename , $ size = null )
36+ public function get ($ filename , $ size = self :: SIZE_LARGE )
3237 {
3338 if (empty ($ filename )) {
3439 return '' ;
@@ -40,13 +45,12 @@ public function get($filename, $size = null)
4045 if (empty ($ filename )) {
4146 return '' ;
4247 }
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 ])) {
4753 $ file_path = $ this ->basepath . $ file [0 ] . '_ ' . $ size . '. ' . $ file [1 ];
48- } else {
49- $ file_path = $ this ->basepath . $ filename ;
5054 }
5155
5256 if (\Config::get ('filesystems.default ' ) == 's3 ' ) {
You can’t perform that action at this time.
0 commit comments