English 中文(简体)
保存有 url2png 的截图到服务器上的最佳方式吗?
原标题:Best way to save an screenshots with url2png to own server?

我有一个网站,它将用 url2png.com 生成截图。 我不喜欢它每30天需要重发一次你的截图, 数到你的极限。

最理想的情况是,我喜欢生成它们,当它完成后,我想把它保存到自己的服务器上,然后在那里查看。

我甚至不知道该从何说起 具体地说...

  1. 如何让他们加入到某种队列中, 直到图像完成并返回( 我之前曾使用过 redi/ resque/ resque_ pool ) 。 但是这相当复杂, 我不太喜欢在这个应用程序上选择非常复杂的路线, 因为许多人会使用。 我更喜欢更简单一些不容易搞砸的东西 )

  2. 如何从铁路上实际获取图像

  3. 如何将图像存储到有特定文件名的特定目录

  4. 如何在我的实际应用程序中引用资产

  5. 如何从模型/ 控制器视图中处理截图 。 它是否应该只是指定给资源的一个额外属性, 比如资源 。 shutshot_ url 吗?

他们确实提供了鲁比宝石, 但我不相信我会使用它, 因为它唯一的选择是从服务器上获取图像, 相反,我会用他们的 URL 格式获取图像, 然后以某种方式生成我自己的 URL 。

http://api.url2png.com/v3/<API_KEY>/ < TOKEN>/ < BOUNDING- BOX>/ < URL>

最佳回答

URL2PNG api 相当快,新的请求立即得到处理,通常在10秒或更短的时间内返回 png。

跟踪每个请求和对状态的民意测验的系统可能已经过火。 如果您正在寻找背景工作, 则是一个不同的故事 。

Parts 2,3,4 and 5 would be handled by the paperclip gem handily. I d suggest starting here: Save image from URL by paperclip

My preferred solution is a cacheing reverse proxy. https://serverfault.com/questions/30705/how-to-set-up-nginx-as-a-caching-reverse-proxy

There is an similar apache module called "mod_disk_cache". ymmv. http://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html

How it works: Your app would make requests to

http://url2png.yourdomain.com/v3/<API_KEY>/<TOKEN>/<BOUNDING-BOX>/<URL>

代理服务器将检查请求是否在缓存中。 如果找不到请求, 请求将被转发到 url2png. com 服务器 。

问题回答

暂无回答




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签