简体   繁体   English

将图像加载到html5画布中

[英]Loading images into html5 canvas

I am using nodejs sails for my app. 我正在为我的应用程序使用nodejs sails。 The app is going to use 50-100 images at some points. 该应用程序将在某些时候使用50-100张图像。 I was wondering if someone can point pro and cons of using /assests/images/ folder vs outside repository ie AWS S3 for image storing and pulling to draw on the canvas. 我想知道是否有人可以指出使用/ assests / images /文件夹与外部存储库(例如AWS S3)进行图像存储和在画布上绘制的利弊。

I would use /assets/images folder if you know that the images are fixed to 50-100. 如果您知道图像固定为50-100,我将使用/ assets / images文件夹。

  • that is, they will not change 也就是说,它们不会改变
  • 50-100 images is not alot of images 50-100张图片不是很多图片

If the images are dynamic and changing all the time, then I would use aws s3. 如果图像是动态的并且一直在变化,那么我将使用aws s3。 To load 50-100 images from S3 will create a "buffering" effect, but it shouldn't be too intolerable. 从S3加载50-100张图像会产生“缓冲”效果,但不要太让人无法忍受。

Yes, use a CDN if you have the option. 是的,如果可以的话,请使用CDN。

Pros : - Save enormously on website load time / speed. 优点 :-大大节省了网站加载时间/速度。 - Better for organization / maintenance. -更好的组织/维护。

Cons : - One more paid account; 缺点 :-还有一个付费帐户; but you may end up having to upgrade your hosting anyway if your images continue to add up with more. 但是如果您的映像继续增加数量,您可能最终还是不得不升级主机。

But a large factor is still, what your plans are for the future of this web property, will you be adding more images, will the website and other parts of it grow? 但是,一个很大的因素仍然是,您对该网络媒体资源的未来有何计划,您是否会添加更多图片,网站及其其他部分会增长吗? What is your current hosting? 您当前托管的是什么? Will you need to update the images alot? 您需要大量更新图像吗? Do you have one developer on this or several? 您是否有一位或多位开发人员? Are these large HQ heavy images? 这些大型总部沉重的图像吗? Or this just a one off landing page that will never be touched again? 还是这只是一个离站页面,将不再被触及?

But I do agree with the other answer, if you'll only have max 100 images; 但是,如果您最多只能有100张图片,我也同意其他答案。 then a CDN is more of luxury. 那么CDN更豪华。 But IMO it's never a fixed amount, and it sounds like you may have several of these HTML5 canvas pages. 但是IMO绝不是固定数量,听起来您可能有几个HTML5画布页面。

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

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