Floating page content bugfix and prevent incompatable image uploads. Fixes #26.
Showing
3 changed files
with
15 additions
and
1 deletions
| ... | @@ -110,7 +110,11 @@ class ImageController extends Controller | ... | @@ -110,7 +110,11 @@ class ImageController extends Controller |
| 110 | public function upload(Request $request) | 110 | public function upload(Request $request) |
| 111 | { | 111 | { |
| 112 | $this->checkPermission('image-create'); | 112 | $this->checkPermission('image-create'); |
| 113 | + $this->validate($request, [ | ||
| 114 | + 'file' => 'image|mimes:jpeg,gif,png' | ||
| 115 | + ]); | ||
| 113 | $imageUpload = $request->file('file'); | 116 | $imageUpload = $request->file('file'); |
| 117 | + | ||
| 114 | $name = str_replace(' ', '-', $imageUpload->getClientOriginalName()); | 118 | $name = str_replace(' ', '-', $imageUpload->getClientOriginalName()); |
| 115 | $storageName = substr(sha1(time()), 0, 10) . '-' . $name; | 119 | $storageName = substr(sha1(time()), 0, 10) . '-' . $name; |
| 116 | $imagePath = '/uploads/images/' . Date('Y-m-M') . '/'; | 120 | $imagePath = '/uploads/images/' . Date('Y-m-M') . '/'; | ... | ... |
| ... | @@ -110,6 +110,12 @@ | ... | @@ -110,6 +110,12 @@ |
| 110 | dz.removeFile(file); | 110 | dz.removeFile(file); |
| 111 | }); | 111 | }); |
| 112 | }); | 112 | }); |
| 113 | + this.on('error', function(file, errorMessage, xhr) { | ||
| 114 | + if(errorMessage.file) { | ||
| 115 | + $(file.previewElement).find('[data-dz-errormessage]').text(errorMessage.file[0]); | ||
| 116 | + } | ||
| 117 | + console.log(errorMessage); | ||
| 118 | + }); | ||
| 113 | } | 119 | } |
| 114 | }); | 120 | }); |
| 115 | }, | 121 | }, | ... | ... |
| ... | @@ -19,12 +19,16 @@ | ... | @@ -19,12 +19,16 @@ |
| 19 | max-width: 840px; | 19 | max-width: 840px; |
| 20 | overflow-wrap: break-word; | 20 | overflow-wrap: break-word; |
| 21 | .align-left { | 21 | .align-left { |
| 22 | - float: left !important; | ||
| 23 | text-align: left; | 22 | text-align: left; |
| 23 | + } | ||
| 24 | + img.align-left, table.align-left { | ||
| 25 | + float: left !important; | ||
| 24 | margin: $-xs $-s $-xs 0; | 26 | margin: $-xs $-s $-xs 0; |
| 25 | } | 27 | } |
| 26 | .align-right { | 28 | .align-right { |
| 27 | float: right !important; | 29 | float: right !important; |
| 30 | + } | ||
| 31 | + img.align-right, table.align-right { | ||
| 28 | text-align: right; | 32 | text-align: right; |
| 29 | margin: $-xs 0 $-xs $-s; | 33 | margin: $-xs 0 $-xs $-s; |
| 30 | } | 34 | } | ... | ... |
-
Please register or sign in to post a comment