Reputation: 221
I'm planning on storing 1000s (hopefully even millions some day) of profile images from facebook and twitter. Their usual size is less than 5k.
What is the best way to do this either in MongoDB or on Amazon S3 and avoid disk fragmentation or similar issues?
Any pointers/tips on the do's and don'ts would be very helpful as well.
Upvotes: 3
Views: 537
Reputation: 872
Yeah, publish profile images from the associated Social site (Facebook, Twitter, etc), but if you have to store uploaded images onto S3, rather than reading the file (from S3) and re-stream it to your user, you can enable the "Website" feature and have your images linked to S3 directly.
So your html image tag will be like:
<img src="http://<amazon s3 - website - endpoint>/<image filename>" title="something">
Upvotes: 1
Reputation: 5416
Why not just store the usernames instead? The profile image can be accessed via the Facebook Graph API (just replace "username" with any Facebook user's username). You'll also save the work of keeping the profile pictures updated.
<img src="http://graph.facebook.com/username/picture" />
Upvotes: 0