From 30f65c3d6d7226a24c2a727d42b7a88caea5b40b Mon Sep 17 00:00:00 2001 From: Espen Antonsen Date: Mon, 11 Apr 2011 13:30:43 +0800 Subject: [PATCH] replaced uploadify with plupload - now can upload without flash! --- Gemfile | 5 +- Gemfile.lock | 2 + app/controllers/photos_controller.rb | 2 +- app/views/photos/upload.html.erb | 97 ++++++++++++++++++++-------- 4 files changed, 77 insertions(+), 29 deletions(-) diff --git a/Gemfile b/Gemfile index ba02ce3..0d65d36 100644 --- a/Gemfile +++ b/Gemfile @@ -23,4 +23,7 @@ gem 'fog' #gem "image_science", :git => 'git://github.com/perezd/image_science.git' # MiniMagick -gem "mini_magick" \ No newline at end of file +gem "mini_magick" + +# Mini exif tool +gem "mini_exiftool" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 59bbccd..d0e3af6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) + mini_exiftool (1.3.0) mini_magick (3.2) subexec (~> 0.0.4) net-ssh (2.0.23) @@ -103,6 +104,7 @@ DEPENDENCIES carrierwave! fog mime-types + mini_exiftool mini_magick pg rails (= 3.0.3) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index cfb16ef..deca277 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -1,5 +1,4 @@ class PhotosController < ApplicationController -#skip_before_filter :verify_authenticity_token before_filter :check_public_access before_filter :require_role_admin, :only => [:untouched, :upload, :new, :create, :edit, :update, :destroy] @@ -75,6 +74,7 @@ class PhotosController < ApplicationController def create @photo = Photo.new(params[:photo]) + @photo.file = params[:file] respond_to do |format| if @photo.save format.html { render :text => "FILEID:" + @photo.file.album.url } diff --git a/app/views/photos/upload.html.erb b/app/views/photos/upload.html.erb index f6a5df4..512b7df 100644 --- a/app/views/photos/upload.html.erb +++ b/app/views/photos/upload.html.erb @@ -1,42 +1,85 @@ <% content_for :javascript do %> -<%= javascript_include_tag "uploadify-2.1/jquery.uploadify.v2.1.0.min.js" -%> -<%= javascript_include_tag "uploadify-2.1/swfobject.js" -%> + +<%= javascript_include_tag "plupload/js/plupload.full.min.js" -%> +<%= javascript_include_tag "plupload/js/jquery.plupload.queue.min.js" -%> <% end %> -
I'm really sorry, you need Flash to upload files.
- +
+

You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.

+
+