流星JS图片上传和显示 [英] Meteor JS image upload and display

查看:151
本文介绍了流星JS图片上传和显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个管理页面的电子商务网站,管理员可以上传某些产品的图片。
我希望Meteor将这些图片上传到一个文件夹中,然后在那个产品的产品页面上显示这些图片。



我知道,通常情况下,图片文件,客户端将使用应该在'公共'文件夹,但我想知道更多我可能有什么其他选项。



另外,如果我上传一个新的文件到'公共'文件夹,或者如果我删除'公共'文件夹中的文件,网站刷新自己...这是好的和坏的同时取决于你是什么效果.. ..

这是我的问题:


  1. 如果我创建一个'上传服务器中的文件夹,并将图像上传到该文件夹​​。是否有可能在客户端浏览器的上传文件夹内显示图像?如何??

  2. 有没有办法使用浏览器来访问公共文件夹的内容???

  3. 有没有办法如果更改发生在创建的上传文件夹中,停止网站的反应性

  4. 将图像上传到公共文件夹可以解决这个问题的最佳解决方案吗?

非常感谢您的帮助

解决方案在处理可能是大量图像的时候,我喜欢不仅将存储空间,而且还将处理转移到第三方。



我的在这种情况下去应用程序将是Cloudinary。这是为什么:


  • 存储 - 我可以将原始图像存储在我的应用程序之外。保持图像从dev到prod同步的巨大好处。
    - 我从Cloudinary CDN快速加载图像的额外好处。

  • 卸载处理 - 图像的所有处理都由Cloudinary处理,不会影响整个应用程序。

  • 图像处理 - 我可以调用原稿图像,调用只是得到一个缩略图,并呼吁改变操纵,即:效果=>灰度。因此,如果上传一张1000x1000像素的图片,我可以从Cloudinary申请一个50x50像素的图片,将图片裁剪为精确的大小,而不是使用CSS来缩小图片。
  • 灵活性 - 我可以改变图像的大小,并返回到应用程序的确切大小,而无需重新上传图像。例如,如果我的产品页面以40px的大拇指拉动,我可以很容易地打一个电话来抓取50px的相同图像。


希望这可以帮助。
http://cloudinary.com/


I'm trying to build a E-commerce site with a admin page where the administrator can upload images of certain products. I'd like Meteor to upload those images to a folder and then display those images in the product page of that product.

I know that normally the image files that the client will be using should be inside the 'public' folder, but I'd like to know more about what other options I might have.

Also, if I upload a new file to the 'public' folder or if I delete a file in the 'public' folder, the website refreshes itself...and this is good and bad at the same time depending on what effect you are after....

Here are my questions:

  1. What if I create a 'uploads' folder in the server and upload the images to that folder. Would it be possible to display the images inside the 'uploads' folder in the client browser??? How??
  2. Is there a way to use the browser to access the contents of the 'public' folder???
  3. Is there a way to stop the 'reactivity' of the site if changes happen in the 'uploads' folder created?
  4. Is uploading the images to the 'public' folder the best solution available to this problem?

Thank you very much for the help

解决方案

When dealing with what will likely be a large number of images I like to offload not only the storage but also the processing to a third party.

My go-to app in this situation would be Cloudinary. Here's why:

  • Storage - I can store the original images outside of my application. A huge benefit to keep images in sync from dev to prod.
  • CDN - I get the extra benefits of images being quickly loaded from the Cloudinary CDN.
  • Off-load Processing - All of the processing of images is handled by Cloudinary which doesn't slow down my app as a whole.
  • Image Manipulation - I can make calls to the original image, calls to just get a thumbnail, and calls to change manipulate, ie :effect => grayscale. So if a 1000x1000px image was uploaded, I can request a 50x50px from Cloudinary that will return the image cropped to that exact size rather than using CSS to shrink a huge image.
  • Flexibility - I can change the size of images and return that exact size to the app without having to re-upload images. For example, if my product page pulled in thumbs at 40px, I could easily make a call to grab the same image at 50px.

Hope this helps. http://cloudinary.com/

这篇关于流星JS图片上传和显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆