我应该使用哪些插件/宝石在 Rails 3 中动态生成缩略图? [英] Which plugins/gems should I use to dynamically generate thumbnails on-the-fly in Rails 3?

查看:28
本文介绍了我应该使用哪些插件/宝石在 Rails 3 中动态生成缩略图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,事情是.我正在构建我的第一个 rails 应用程序,它从目录及其子目录中读取图像.现在,我想生成这些图像的动态缩略图.但我不想用缩略图填充该目录.我正在考虑在临时目录中为每个用户单独缓存这些拇指.

So, the thing is. I'm building my first rails app which reads images from a directory and it's subdirs. Now, I want to generate dynamic thumbnails of those images. But I don't want to fill up that directory with the thumbnail images. I was thinking of caching these thumbs separately for each user in temporary directory.

哦,而且,我还需要一些 css 魔法的图像尺寸.

Oh, and, I would also need the dimensions of the images for some css magic.

我应该使用什么插件/gems/...来实现这一点?

What plugins/gems/... should I use to accomplish this?

推荐答案

你应该将 rmagickPaperclip 结合起来.通过这种方式,您可以指定尺寸(以及图像的许多其他属性),并即时制作缩略图.

You should rmagick coupled with Paperclip. In this way you can specify the dimensions (and many other attributes of the images), and make thumbnails on the fly.

除此之外,我还会添加 delayed_job ,它将作为图像处理的背景,因此如果客户端提供了其中任何一个,他们将不必等待它完整的客户端.

On top of this, I would also add in delayed_job which will background the process of the images so if any of them are provided by the client, they won't have to wait for it to complete client-side.

rMagick : http://github.com/rmagick/rmagick

纸夹:http://github.com/thoughtbot/paperclip

delayed_job:http://github.com/collectiveidea/delayed_job

delayed_job: http://github.com/collectiveidea/delayed_job

这篇关于我应该使用哪些插件/宝石在 Rails 3 中动态生成缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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