Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

enabled album art uploader

  • Loading branch information...
commit d4d543ad4e0c153b1921275007ebb78237340241 1 parent 359be96
James Reynolds authored
2  app/controllers/albums_controller.rb
View
@@ -134,7 +134,7 @@ def upload_cover
@album.cover = nil
file = params[:file]
ext = File.extname(file.original_filename)[1..-1]
- @album.add_cover(file.local_path, ext)
+ @album.add_cover(file.path, ext, false) # TODO: segfault when processing thumbnail in mongrel
logger.info "*** FILE: #{file.original_filename}, #{file.path}, #{file.inspect}"
if @album.save
# TODO: ajax upload doesn't work
8 app/models/album.rb
View
@@ -55,12 +55,14 @@ def extract_cover(replace_cover=true)
end
# resize and attach the image at the raw path
- def add_cover(original, format=nil)
+ def add_cover(original, format=nil, thumb=true)
processor = Toastunes::ImageProcessor.new
full_path = processor.save_cover(id, original, format)
- thumbnail_path = processor.write_thumbnail(id, full_path)
self.cover = File.basename(full_path)
- self.thumbnail = File.basename(thumbnail_path)
+ if thumb
+ thumbnail_path = processor.write_thumbnail(id, full_path)
+ self.thumbnail = File.basename(thumbnail_path)
+ end
end
def download_cover(url)
1  app/views/albums/_album_art.haml
View
@@ -9,4 +9,5 @@
.error= error
- if album.cover_download_at
.error= "Last checked on #{album.cover_download_at.strftime("%m/%d/%Y")}"
+ = render :partial => "album_cover_upload", :locals => {:album => album}
.clear
Please sign in to comment.
Something went wrong with that request. Please try again.