Avoid the ImageNotWritableException in Fortrabbit using Intervention

1.5k views Asked by At

I am using the Intervention/Image package with Laravel 4.1 and I am trying to make it work with Fortrabbit. It works well locally. Although when I try to save an image on the prodution app hosted on Fortrabbit, I receive an Intervention \ Image \ Exception \ ImageNotWritableException exception. I have tried to run chmod 775 on the uploads folder but this didn't fix the problem. I don't have write-on protection for the moment so this cannot be the cause of the problem.

I am wondering if I should run a chown of some sort on the folder or if this may come from somewhere else?

1

There are 1 answers

0
Holger Weis On BEST ANSWER

Try to use an absolute path to your image resource, for example by using one of the path helper functions. The following code works well with Laravel 4.1 and Intervention on fortrabbit:

Route::get('image', function()
{
    $img = Image::make(public_path().'/files/image.jpg');
    $img->flip('h');

    return '<img src="data:image/jpeg;base64,'.base64_encode($img).'">';
});