jeudi 24 mai 2018

NotWritableException Can't write image data to path on heroku

I am trying to save my image data to a folder. It works fine on my localhost but when i moved it to heroku it gives me this error

NotWritableException
Can't write image data to path (https://arcane-peak- 
34431.herokuapp.com/public/images/categories/1527155055.jpg)

Here is my code.

$image = $request->file('image');
    $imagename = $image->getClientOriginalExtension();
    $imagename = time().'.'.$imagename;

    $destinationPath = URL::to('public/images/restaurants');
    $img = Image::make($image->getRealPath());

    $img->resize(100, 100, function ($constraint) {
        $constraint->aspectRatio();
    })->save($destinationPath.'/'.$imagename);

    $destinationPath = URL::to('public/images/restaurants');

    $image->move($destinationPath, $imagename);

What am i doing wrong? And also on my local machine it is the uploaded image that is getting saved but i want my resized image to be saved.Any help would be a life saver



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire