You may have noticed that I’ve not added any images to posts since I started blogging again this year. For whatever reason, images had broken completely. They didn’t show on posts, they didn’t even show in the media library where I was met by a grid of grey icons and even clicking through into the image didn’t show it. Oddly clicking to edit the image actually did show the image, so it was clearly there somewhere!
Thankfully, I finally figured out what was broken and now things are working again 🙂
There are so many posts out there about broken images but none of them seemed to fix things for me. The majority talked about these three things:
- Disabling all Plugins and then seeing if that worked.
- Resetting the Theme to a default WP theme.
- Using a plugin to rebuild thumbnails.
None of those worked for me.
So in the end I decided to look back to an old post from 2010 and see if that had images also not showing. It turned out that the images didn’t work there either. That led me to believe that this was a global issue not something related to new posts. I then used the browser to show the source of the post I was looking at. That enabled me to get the actual web link to the image. When I put that in its own browser window it finally gave me a useful error message. Essentially I didn’t have permission to view the file.
With that information to go on I went looking to see what the permissions should be on the uploads directory where my images are stored. The general consensus seemed to be that 755 was suitable.
Therefore I used the following command from an SSH terminal:
CHMOD -R 0755 ./uploads
This recursively sets 755 permissions on all the folders and files in the uploads directory (assuming you’ve already navigated using the “ls” command to the folder holding the uploads directory).
Excitingly, my media library now works: