Can't write image data to path - Intervention Image

Posted on: 22/05/2018. Last updated at: 05/06/2020

I'd been wracking my brain for a few days about this, searching the web for a solution to "Can't write image data to path (storage/thumbs/filename.jpeg)". Then it finally hit me, it was a permissions issue.

I needed to give the webserver (Apache in my case) ownership of the folder i was wanting to save files to. My current setup is to share the ownership of the files / folders with myself and the webserver.

You can see my post about how to set file permissions for Laravel 5 on mac OSX, for more details.

As you can see from the screenshot below, within my storage/app/public folder i have a thumbnails folder which i wanted to save images to.

File permissions of the laravel storage folder

My user and _www share ownership of the folder. All i needed to do was change the ownership to be Apache for both. To do this type the following command in your terminal window:

cd yourprojectname/storage/app/public
sudo chown _www:_www thumbnails

The only side effect of this is that if you ever need to delete the files from the folder, you'll have to type your password in to authorise it, since you are no longer the owner of the files. However in a production environment it will be very likely that the webserver is the owner of all the files and folders in your project, so you'll never come across this problem, only when developing locally.

As a side note, You can use this fix for any project you use Intervention Image with. It's not Laravel dependant.

Hope this helps someone!


Picture of Daniel Ord
Daniel Ord

Building things for the Web. Follow me on Twitter or checkout my GitHub.

More Posts

Backup MySQL database to Digital Ocean Spaces
Creating backups of your database is a no-brainer. There are lots of guides on how to do this and upload...
How to Install Laravel Spark
Doing a fresh install of Laravel Spark or even an upgrade has proved problematic almost every time i attempt it....
Upload multiple files, create thumbnails with Spatie MediaLibrary
Not sure how to use Spatie Media-Library? This guide shows you how to upload multiple images with thumbnail conversion and...
Laravel PDF API
As part of my day job I was required to make PDF's from HTML templates and expose this via an...

Other Categories