diff --git a/.gems b/.gems deleted file mode 100644 index 566aaaa..0000000 --- a/.gems +++ /dev/null @@ -1,4 +0,0 @@ -authlogic -carrierwave -aws-s3 -mini_exiftool diff --git a/Gemfile b/Gemfile index b17b4a3..08b746b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,16 +6,19 @@ gem "authlogic" gem 'mime-types', :require => 'mime/types' gem "carrierwave", :git => 'git://github.com/jnicklas/carrierwave.git' # MySQL: -gem "mysql2" +#gem "mysql2" # PostgreSQL: -#gem 'pg' +gem 'pg' + +# S3 support +gem 'fog' # ImageMagick: -#gem "rmagick", :require => 'RMagick' +gem "rmagick", :require => 'RMagick' # FreeImage: -#gem "image_science", :git => 'git://github.com/perezd/image_science.git' #gem "RubyInline" +#gem "image_science", :git => 'git://github.com/perezd/image_science.git' # MiniMagick -gem "mini_magick" \ No newline at end of file +#gem "mini_magick" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 83090a6..de50597 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -42,14 +42,26 @@ GEM builder (2.1.2) erubis (2.6.6) abstract (>= 1.0.0) + excon (0.2.3) + fog (0.3.7) + builder + excon (>= 0.2.3) + formatador (>= 0.0.15) + json + mime-types + net-ssh (~> 2.0.23) + nokogiri (~> 1.4.3.1) + ruby-hmac + formatador (0.0.15) i18n (0.4.1) + json (1.4.6) mail (2.2.6.1) activesupport (>= 2.3.6) mime-types treetop (>= 1.4.5) mime-types (1.16) - mini_magick (2.1) - subexec (~> 0.0.4) + net-ssh (2.0.23) + nokogiri (1.4.3.1) pg (0.9.0) polyglot (0.3.1) rack (1.2.1) @@ -71,7 +83,8 @@ GEM rake (>= 0.8.4) thor (~> 0.14.0) rake (0.8.7) - subexec (0.0.4) + rmagick (2.13.1) + ruby-hmac (0.4.0) thor (0.14.1) treetop (1.4.8) polyglot (>= 0.3.1) @@ -83,7 +96,8 @@ PLATFORMS DEPENDENCIES authlogic carrierwave! + fog mime-types - mini_magick pg rails (= 3.0.0) + rmagick diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 3058654..cd51129 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -59,8 +59,8 @@ class AlbumsController < ApplicationController unless params[:collection_id].empty? @album.collections << Collection.find( params[:collection_id] ) end - flash[:notice] = "Album created!" - redirect_to @album + flash[:notice] = "Album created! Now add some nice photos." + redirect_to upload_album_photos_path( @album ) else render :action => :new end diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index c96a8ae..bd67f8e 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -29,8 +29,8 @@ class CollectionsController < ApplicationController def create @collection = Collection.new(params[:collection]) if @collection.save - flash[:notice] = "Collection created!" - redirect_to @collection + flash[:notice] = "Collection created! Now lets add a new album." + redirect_to new_collection_album_path(@collection) else render :action => :new end diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 24e4699..cb8d3d8 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -74,7 +74,9 @@ class PhotosController < ApplicationController end def create + puts "create" @photo = Photo.new(params[:photo]) + puts @photo.inspect respond_to do |format| if @photo.save format.html { render :text => "FILEID:" + @photo.file.album.url } diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb index c544479..41ac66b 100644 --- a/app/uploaders/file_uploader.rb +++ b/app/uploaders/file_uploader.rb @@ -3,11 +3,10 @@ class FileUploader < CarrierWave::Uploader::Base # Include RMagick or ImageScience support - # include CarrierWave::RMagick + include CarrierWave::RMagick # include CarrierWave::ImageScience - include CarrierWave::MiniMagick + # include CarrierWave::MiniMagick # Choose what kind of storage to use for this uploader - #storage :file if ENV['S3_KEY'] storage :s3 @@ -22,7 +21,7 @@ class FileUploader < CarrierWave::Uploader::Base # This is a sensible default for uploaders that are meant to be mounted: def store_dir #{}"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" - "uploads/files/#{model.album.path}" + ENV['STORAGE_PATH'] + "/files/#{model.album.path}" end # Provide a default URL as a default if there hasn't been a file uploaded @@ -41,25 +40,25 @@ class FileUploader < CarrierWave::Uploader::Base version :collection do process :resize_to_fill => [200, 200] def store_dir - "uploads/thumbs/#{model.album.path}" + ENV['STORAGE_PATH'] + "/files/thumbs/#{model.album.path}" end end version :album do process :resize_to_fill => [100, 100] def store_dir - "uploads/thumbs/#{model.album.path}" + ENV['STORAGE_PATH'] + "/files/thumbs/#{model.album.path}" end end version :preview do process :resize_to_fit => [210, 210] def store_dir - "uploads/thumbs/#{model.album.path}" + ENV['STORAGE_PATH'] + "/files/thumbs/#{model.album.path}" end end version :single do process :resize_to_limit => [950, 950] def store_dir - "uploads/thumbs/#{model.album.path}" + ENV['STORAGE_PATH'] + "/files/thumbs/#{model.album.path}" end end diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 20f9e35..8b8a2ae 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -46,6 +46,6 @@ <%= link_to "Edit album", edit_album_path(@album) %> | <%= link_to "Edit all photos", edit_multiple_album_photos_path(@album) %> | <%= link_to "Edit untouched photos", untouched_album_photos_path(@album) %> | -<%= link_to "Add photos", upload_album_photos_path(@album) %> -<% end %> +<%= link_to "Add photos", upload_collection_album_photos_path(params[:collection_id], @album) %> <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ff3862d..754a285 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@
-