I have a social media website and wondering if it's wiser to just use a 3rd party service to host my images. I look at websites like stackoverflow and they use Imgur to host all of their images. Is the reason for this is because images are so heavy and costly to store? Would really like some advice.
I use cloudinary to deliver images if there are tons of images.
You mentioned imgur, other mentioned CDNs, and your problem seems to focus on social media (IMHO stackoverflow is not primarily a social media platform in the common sense)
Based on this I’d like to add another dimension in the tech decision you have to make: who is the owner of the uploaded media, what are the guarantees you want to provide (e.g. if your social stuff has private content)
The main distinction I make here is:
So my advice would be to start be really trying to flesh out all the criteria you have for the media hosting of your social platform solution. Here’s a quick brain dump, I’m sure you have much more ideas. You can use this as a basic o get started and see my point:
Once you get this list (this could be a very important decision, because of the cost/effort required to change it afterward), add weights on each criterion: is this stuff absolutely required? Something nice? Something you don’t think you‘ll need at all. Ideally, those weights should be agreed on by all stakeholders. One thing I loved in my last tech decision is to use a non-linear scale: each criterion gets a 9, 3, 1 or 0. This scale forces decisions and avoids to get all-grey scores (everything between 3 to 7 on a 0-10 scale). Also if the scores are not well distributed (e.g. you put 75% of 9s), refine it to force decision: if everything has a high priority, then there’s no priority. Take all those 9s and decide which ones of those are most important than other ones ;)
Once this is done, you have a non-biased set of criteria which describe your actual problem and identify your real needs (and not just what you believe your needs are. This list has been reviewed by the team so you have a common understanding of your needs)
Then for each possible solution (build your own, use CDN from provider A, use CDN from provider B, use some image hosting C, ...) put a score for each criterion.
Then if you multiply each score by each weight, you get the actual score for this criteria for each provider, according to your actual needs. Sum up all the weighted score for a given solution, and you get the grand total of that solution according to your priorities. The solution with the highest score is the one which best fits your problem space.
I found this exercize really helpful fo many reasons:
Hope this helps
There are a couple of reason to host on 3rd party sites
For my product, our servers output is 99% json. Rest is handled by 3rd party services like these. We use Cloudinary, Netlify, Google Cloud Storage, Google CDN, etc
I'd start with a 3rd party site until it starts affecting you or your users.
Your website's value is about the interaction and the experience of consuming those pictures, not in where the bytes are served from. Let the file hosting experts deal with that, so you can spend all of your time building amazing experiences for your users.
Some time ago we used local storage on servers. It is ok as long, as you would not keep many files. It can have some security advantage, if you have good security team. Biggest issues are disk space and network capacity.
In many apps we need to restrict access to files, so we do not put files on public, but process request through php/node/python/etc. and return file as response if user has access to it. For us it was easier to keep such files on the same server as app… But we had problems with disk space. When we use the same server for media and data processing, you can do less, because some of your resources are used for media transfer… For few years I avoid local storage.
So you can create your own file server, but why you would do that? Only reasons which come to my mind are: security and full control over storage. But there is always some solution for example if you need to set some access restriction, in many cases you can restrict access to storage and use APIs to get files and process them within your app.
Right now, when we build simple page with few images, we put image in public and use some cache… But In most cases we use amazon S3 (we use AWS a lot...). If you build social media website consider some 3rd party storage. If you need it only for image consider some service build around images like cloudinary.com (they have not only storage and cdn, but also lot of good stuffs like auto resizing/croping, dynamic resize/crop based on url etc.)
Remember also about some cdn and cache if it is not built-in.
The biggest benefits of 3rd parties are:
There can be some legal problems, so you need to consider how image access should be restricted, how they are secured, in which country physical servers are etc.
If you have alot of images then it would be wiser, the reason most websites do this because it reduces the page loading time on the server for those images, so just linking everything would be much quicker than say 5mb worth of images.
Also helps mobile responsiveness loading time
I think there are a few out there for third party but I havnt done this in ages so cant help for that one.
Balance Blind
I think that if you have the ability to host yourself, you can use this option. However, if you do not want to get in a situation when your hosting gets hacked, it is better to use reliable and verified file hosting sites such as a good anonymous file upload site. I recommend you to read more about fastupload. Maybe it will be useful for you.