开发者

Rails - creating a system for drag-and-drop download

This is a problem I'm trying to think about how to approach -- I haven't actually started it yet.

What I want to do is create a system where there is a gallery of images. These images can be dropped into a folder or some icon in one part of the screen. Then, the images that have been placed in this folder should be able to be downloaded as a zip.

I was intending to use jQuery to do the drag and drop, probably with some AJAX to accomplish the rest of the stuff, but I'm really just not sure how I would accomplish doing this, or if it's even possible (like if the web application can compress the folder of开发者_JAVA百科 images).

Also, I'd be programming in Rails 3.

Any ideas?


Sounds like a neat interface. I think jQuery drag and drop is the way to go. Once an image is dropped, trigger an AJAX request GET '/photos/download/#{photo_id}'. This action could then utilize Rails send_file, http://apidock.com/rails/ActionController/Streaming/send_file.

def download
  @photo = Photo.find(params[:id])
  send_file @photo.image
end  
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜