Hey everyone! I previously built a social media app on Heroku where users could post images. However, I noticed that my images would disappear every time the app reset, which happened daily. I understand that storing only the image paths in the database is standard practice, but I was still using Heroku to store the images, which is problematic since they get deleted during resets. On my local machine, saving images in the project directory works perfectly, but Heroku seems to wipe those files clean. What are the best practices for storing images to avoid losing them, especially while using Heroku?
2 Answers
You might want to try using Cloudinary. They have a great free tier with lots of features. Plus, they offer an uploader widget that makes it easy for users to upload images directly through a browser, which can enhance the user experience.
You should consider hosting your images externally, either on AWS S3 or something similar like MinIO. If you're using Docker, you could mount a persistent volume, but make sure all your servers can access it. On Heroku, check what services they offer for persistent storage since that's crucial for keeping your media intact.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically