bestmomo/laravel5-5-example

Error posting post

yuri25 opened this issue · 3 comments

When posting a post, this error occurs:
Intervention \ Image \ Exception \ NotReadableException Unable to init from given url (http://youwo.ru/\files/img02.jpg).

Unable to init from given url (http://youwo.ru/\files/img02.jpg). /......../youwo.ru/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php#83

Check folder authorizations.

Error found here:
/...../resources/views/back/posts/template.blade.php

222        function processSelectedFile(filePath, requestingField) {
223            $('#' + requestingField).val('\\' + filePath)
224            $('#img').attr('src', '\\' + filePath)
225           }

It is necessary to change slashes as follows:

222        function processSelectedFile(filePath, requestingField) {
223            $('#' + requestingField).val('\/' + filePath)
224            $('#img').attr('src', '\/' + filePath)
225           }

Now this error has been fixed.

Or it can also happen because of

// App\Services\Thumb.php
// Error found here:
$image = Image::make(url($model->image))->widen(100);

// updated
$image = Image::make(public_path() . $model->image)->widen(100);

note: this is just an alternative solution