简体   繁体   English

在本地存储图像 vs cloudinary vs s3

[英]store images locally vs cloudinary vs s3

The settings:设置:

Blog with posts, buily with Laravel, where:带有帖子的博客,使用 Laravel 构建,其中:

  • Every post can have max of 1 image (nullable).每个帖子最多可以有 1 张图片(可为空)。
  • Max posts in the blog is 1000. Let's assume there are 1000 posts for the discussion.博客中的最​​大帖子数为 1000。假设有 1000 个帖子供讨论。
  • Every post has a comment section.每个帖子都有评论区。 Where registered users can comment and include an image in their comment.注册用户可以在这里发表评论并在评论中包含图片。 Lets assume every post has 2 images in the comments.让我们假设每个帖子在评论中都有 2 张图片。

So in total it counts to 3000 images* that need to be stored (and resized I guess), presented, and etc.因此,它总共需要存储(我猜是调整大小)、呈现等 3000 张图像*。

This is the ideal amount in the long range, I'm not looking for a "scaleable" solution, since there is not going to be a crazy exponential growth.这是长期的理想数量,我不是在寻找“可扩展”的解决方案,因为不会出现疯狂的指数增长。

*In reality for the time being it is less, and I assume that for these amounts of media files it doesn't really matter if its 1000/1500/2000 or 3000.. Correct me if that's wrong. *实际上目前它更少,我认为对于这些数量的媒体文件,它是 1000/1500/2000 还是 3000 并不重要。如果那是错误的,请纠正我。

Few extra things to note:一些额外的注意事项:

  • I'm hosting it in shared hosting (I can store up to 300k files).我将它托管在共享主机中(我最多可以存储 30 万个文件)。
  • I want it to be secured, so no malicious file is uploaded in the cover of an image file.我希望它受到保护,因此不会在图像文件的封面中上传恶意文件。
  • I'm looking for a budget solution (so if s3 will start charging hard after 12 months it makes it not relevant), preferably free (.我正在寻找一种预算解决方案(因此,如果 s3 将在 12 个月后开始硬收费,则它不相关),最好是免费的 (.

So the dilemma is between storing all images locally in Storage folder (manipulating images with some Laravel package).因此,困境在于将所有图像本地存储在 Storage 文件夹中(使用某些 Laravel 包操作图像)。 Other possibility is cloudinary, which I don't know much about, just that it enables to store/manipulate/backup/use their api to present the images I stored there.另一种可能性是cloudinary,我不太了解,只是它可以存储/操作/备份/使用他们的api来呈现我存储在那里的图像。

If I choose to do it locally - is it safe to store a user uploaded image locally?如果我选择在本地进行 - 在本地存储用户上传的图像是否安全? how do I make sure it's not malware in disguise of an image file?我如何确保它不是伪装图像文件的恶意软件?

With this amount of images/content can it cause performance issues in the shared hosting when storing locally?如此数量的图像/内容在本地存储时是否会导致共享主机的性能问题?

What would be the advantages of using cloudinary for me?使用 cloudinary 对我有什么好处?

Thanks.谢谢。

Cloudinary can actually help a lot in this case.在这种情况下,Cloudinary 实际上可以提供很多帮助。 Instead of storing the resources locally and writing something up to manipulate them, you could integrate Cloudinary in the project.您可以将 Cloudinary 集成到项目中,而不是在本地存储资源并编写一些内容来操作它们。

This would free up server space.这将释放服务器空间。 Storing images locally may or may not impact performance, depending on the architecture, but freeing server resources is always a good practice.在本地存储图像可能会或可能不会影响性能,具体取决于体系结构,但释放服务器资源始终是一个好习惯。

Also, manipulation and delivery of images could be done on the fly when first requested (or eagerly before they are requested if you want to) by a simple API call.此外,通过简单的 API 调用,可以在第一次请求时(或在请求之前急切地请求)图像的操作和交付。 So you don't need to make up something new, but leverage already existing API.因此,您不需要编写新的东西,而是利用现有的 API。

Cloudinary also has a fully-featured free tier that you could use. Cloudinary 还有一个功能齐全的免费套餐供您使用。 If you don't expect exponential growth at the moment, that tier would be more than enough for the project如果您目前不期望指数级增长,那么该层对于项目来说已经绰绰有余了

Full disclosure: I'm currently working at Cloudinary, (but the above still holds :) ).完全披露:我目前在 Cloudinary 工作,(但上述内容仍然成立 :))。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM