I’m hosting a wordpress site on heroku and I’m having problems getting my featured image for my blog posts to stay up….
I say stay up because when i first post it…it will show up but after a while it will go away…
I’ve had similar problems with other images that i’ve uploaded but i fixed that by just giving the image path e.g. http://www.somesite.com/image.jpg
however i am unable to do this with featured images….
any ideas on how i can get around this problem?
The problem is because Heroku doesn’t allow you to have persistent storage on the Dynos. So initially when you upload the image it’ll work but Heroku will sometimes restart your Dyno or move it to some other host (as they constantly shift applications to load balance their servers).
In order to make sure that your images stay online you should use a WordPress Plugin that uploads to a persistent storage service such as Amazon S3. You could give this plugin a try: Amazon S3 for WordPress
The great thing about using Amazon S3 is that it’s free for the first year if you use their Free Tier. You will have some limits but if it’s a low traffic site, you shouldn’t go beyond them easily.
If you don’t want to use paid service like Amazon S3, you could just git push the image.jpg file so that it will remain in heroku forever.
Here heroku is the remote url and master is the branch in it. This can be done when there is a local git.