开发者

How to render uploaded photos with NodeJS and Express?

开发者 https://www.devze.com 2023-02-16 07:34 出处:网络
I generally post exa开发者_JAVA百科mples of my best shot at what I\'m asking about, but in this case, I have no idea where to start (haven\'t uploaded photos before in other languages).

I generally post exa开发者_JAVA百科mples of my best shot at what I'm asking about, but in this case, I have no idea where to start (haven't uploaded photos before in other languages).

So how does one go about rendering uploaded photos. I'm using Node v0.4.2, Express 1.0.8, and Mongoose 1.0.16 and have uploading of images working (they end up in ~/tmp right now).

Thanks.


If you just want to render thumbnail versions of your uploaded images for display, try using the imagemagick wrapper node-imagemagick.

For example, you could store your hires-images in a data-folder on your server (lets say /data/images) and render thumbnail images into a web-accessible folder (on upload).

I do not recommend generating the thumbnails on the fly, as it can massively increase your server's load when a large image (especially vector formats like eps or pdf) is being rendered.

For imagemagick examples, consider reading up the docs for the convert command.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号