Skip to content

Commit 79d98d6

Browse files
committed
arrange configs
1 parent 10b9413 commit 79d98d6

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

src/LfmPath.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,15 @@ private function uploadValidator($file)
243243
$type_key = $this->helper->currentLfmType();
244244

245245
if (config('lfm.should_validate_mime', false)) {
246-
$mine_config = 'lfm.valid_' . $type_key . '_mimetypes';
247-
$valid_mimetypes = config($mine_config, []);
248-
if (false === in_array($mimetype, $valid_mimetypes)) {
246+
if (false === in_array($mimetype, $this->helper->availableMimeTypes())) {
249247
return $this->error('mime') . $mimetype;
250248
}
251249
}
252250

253251
if (config('lfm.should_validate_size', false)) {
254-
$max_size = config('lfm.max_' . $type_key . '_size', 0);
255252
// size to kb unit is needed
256253
$file_size = $file->getSize() / 1000;
257-
if ($file_size > $max_size) {
254+
if ($file_size > $this->helper->maxUploadSize()) {
258255
return $this->error('size') . $file_size;
259256
}
260257
}
@@ -294,8 +291,6 @@ public function makeThumbnail($filename)
294291
// create folder for thumbnails
295292
$this->setName(null)->thumb(true)->createFolder();
296293

297-
\Log::info($this->thumb(false)->setName($filename)->path('absolute'));
298-
299294
// generate cropped thumbnail
300295
Image::make($this->thumb(false)->setName($filename)->path('absolute'))
301296
->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200))

src/config/lfm.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,8 @@
9797

9898
'should_validate_size' => false,
9999

100-
101100
'should_validate_mime' => false,
102101

103-
// If true, image thumbnails would be created during upload
104-
'should_create_thumbnails' => true,
105-
106-
// Create thumbnails automatically only for listed types.
107-
'raster_mimetypes' => [
108-
'image/jpeg',
109-
'image/pjpeg',
110-
'image/png',
111-
],
112-
113102
// permissions to be set when create a new folder or when it creates automatically with thumbnails
114103
'create_folder_mode' => 0755,
115104

@@ -118,10 +107,20 @@
118107

119108
/*
120109
|--------------------------------------------------------------------------
121-
| Thumbnail Dimensions
110+
| Thumbnail
122111
|--------------------------------------------------------------------------
123112
*/
124113

114+
// If true, image thumbnails would be created during upload
115+
'should_create_thumbnails' => true,
116+
117+
// Create thumbnails automatically only for listed types.
118+
'raster_mimetypes' => [
119+
'image/jpeg',
120+
'image/pjpeg',
121+
'image/png',
122+
],
123+
125124
'thumb_img_width' => 200,
126125

127126
'thumb_img_height' => 200,

0 commit comments

Comments
 (0)