Skip to content

Commit

Permalink
Okay, doubling back on that last commit, making it all relative locat…
Browse files Browse the repository at this point in the history
…ions seems to break the server, however using full absolute paths using Rails.root for everything (and some systemd changes, actually...) fixes the issue entirely.
  • Loading branch information
Wingar committed Jan 26, 2016
1 parent 6e6a2b9 commit 75d12a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/photo_store.rb
Expand Up @@ -23,10 +23,10 @@ def upload(temp_file, uploader)
end
return { status: 'File exceeds maximum file size of 10MB' } if temp_file.tempfile.size >= 10000000 # 10MB
photo = store(temp_file, uploader)
img.resize_to_fit(MEDIUM_IMAGE_SIZE).write "tmp/#{photo.store_filename}"
FileUtils.move "tmp/#{photo.store_filename}", md_thumb_path(photo.store_filename)
img.resize_to_fill(SMALL_IMAGE_SIZE).write "tmp/#{photo.store_filename}"
FileUtils.move "tmp/#{photo.store_filename}", sm_thumb_path(photo.store_filename)
img.resize_to_fit(MEDIUM_IMAGE_SIZE).write "#{Rails.root}/tmp/#{photo.store_filename}"
FileUtils.move "#{Rails.root}/tmp/#{photo.store_filename}", md_thumb_path(photo.store_filename)
img.resize_to_fill(SMALL_IMAGE_SIZE).write "#{Rails.root}/tmp/#{photo.store_filename}"
FileUtils.move "#{Rails.root}/tmp/#{photo.store_filename}", sm_thumb_path(photo.store_filename)
photo.save
{ status: 'ok', photo: photo.id.to_s }
rescue EXIFR::MalformedJPEG
Expand Down

0 comments on commit 75d12a1

Please sign in to comment.