Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-01-17 15:19:26 +0000
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
bb87401d1064e7c792467b49cb49e809edd2087f
bb87401d
1 parent
0821672e
Improved image upload error handling and fixed bad user-avatar rewriting
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
app/Exceptions/ImageUploadException.php
app/Http/Controllers/ImageController.php
resources/assets/js/directives.js
app/Exceptions/ImageUploadException.php
0 → 100644
View file @
bb87401
<?php
namespace
BookStack\Exceptions
;
use
Exception
;
class
ImageUploadException
extends
Exception
{}
\ No newline at end of file
app/Http/Controllers/ImageController.php
View file @
bb87401
...
...
@@ -2,6 +2,7 @@
namespace
BookStack\Http\Controllers
;
use
BookStack\Exceptions\ImageUploadException
;
use
BookStack\Repos\ImageRepo
;
use
Illuminate\Filesystem\Filesystem
as
File
;
use
Illuminate\Http\Request
;
...
...
@@ -69,7 +70,13 @@ class ImageController extends Controller
]);
$imageUpload
=
$request
->
file
(
'file'
);
$image
=
$this
->
imageRepo
->
saveNew
(
$imageUpload
,
$type
);
try
{
$image
=
$this
->
imageRepo
->
saveNew
(
$imageUpload
,
$type
);
}
catch
(
ImageUploadException
$e
)
{
return
response
(
$e
->
getMessage
(),
500
);
}
return
response
()
->
json
(
$image
);
}
...
...
resources/assets/js/directives.js
View file @
bb87401
...
...
@@ -56,6 +56,7 @@ module.exports = function (ngApp) {
var
usingIds
=
typeof
scope
.
currentId
!==
'undefined'
||
scope
.
currentId
===
'false'
;
scope
.
image
=
scope
.
currentImage
;
scope
.
value
=
scope
.
currentImage
||
''
;
if
(
usingIds
)
scope
.
value
=
scope
.
currentId
;
function
setImage
(
imageModel
,
imageUrl
)
{
scope
.
image
=
imageUrl
;
...
...
Please
register
or
sign in
to post a comment