0

I am using unisharp filemanager in Laravel 5.4 - laravel-filemanager

I configured everything according to the documentation and Integration. I can upload files now, but unable to crop and resize the same uploaded image.
I get following error in console

Failed to load resource: the server responded with a status of 500 (Internal Server Error) - http://127.0.0.1:8000/laravel-filemanager/doresize?img=http%3A%2F%2F127.0.0.1%3A8000%2Fphotos%2F1%2F835e871b8f5105255b1ead21947b6799.jpeg&working_dir=%2F1&dataHeight=&dataWidth=&=1490245875358

And if I go to the link above it throws an error

NotReadableException in AbstractDecoder.php line 335: Image source not readable

Code in crop.blade.php in filemanager looks like below

 <button class="btn btn-primary" onclick="performCrop()">
  {{ trans('laravel-    filemanager::lfm.btn-crop') }}
 </button>
 <button class="btn btn-info" onclick="loadItems()">
  {{ trans('laravel-    filemanager::lfm.btn-cancel') }}
 </button>
  <form action="{{ route('unisharp.lfm.getCrop') }}" role='form' name='cropForm' id='cropForm' mathod='post'>
    <input type="hidden" id="img" name="img" value="{{ $img }}">
    <input type="hidden" id="working_dir" name="working_dir" value="{{ $working_dir }}">
    <input type="hidden" id="dataX" name="dataX">
    <input type="hidden" id="dataY" name="dataY">
    <input type="hidden" id="dataWidth" name="dataWidth">
    <input type="hidden" id="dataHeight" name="dataHeight">
    <input type='hidden' name='_token' value='{{csrf_token()}}'>
  </form>`

How to resolve this 500 Internal Server Error error?

Amr Aly
  • 3,871
  • 2
  • 16
  • 33
Vivek Padhye
  • 731
  • 3
  • 13
  • 26
  • where is the code you are using to save and resize your images? – Amr Aly Mar 23 '17 at 06:06
  • @AmrAly `filemanager` handles it. I did not qrite my own code. the code in `crop.blade.php` in filemanager package I have updated above – Vivek Padhye Mar 23 '17 at 06:09
  • have you ensured that the files & images directories `(in config/lfm.php)` are writable by your web server as they have suggested – Amr Aly Mar 23 '17 at 06:14

2 Answers2

0

Try chown and chmod in directory where you want to upload files. Here is a Tutorial chmod, chown

Vahe Galstyan
  • 1,681
  • 1
  • 12
  • 25
0

Go in yourprojectname/unisharp/laravel-filemanager/views/crop.blade.php and on this method: function

performCrop(){..
data:{
  img: '{{ $img }}', -> change this with 
  img: '{{ parse_url($img, PHP_URL_PATH) }}',

  ...
}

do the same for resize.balde.php

refer link: https://github.com/UniSharp/laravel-filemanager/issues/213

Jahja
  • 1