mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Moved view logging to after the image is sent to improve performance.
This commit is contained in:
parent
16f9895048
commit
3379f36b61
@ -19,9 +19,9 @@ class PhotosController < ApplicationController
|
||||
def show
|
||||
# Log the view
|
||||
@photo = Photo.find(params[:id])
|
||||
@photo.log_view
|
||||
# Get the image and send it to the browser
|
||||
data = File.open(@photo.photo.path, 'rb').read
|
||||
send_data(data , :filename => 'photo', :type => 'image/jpg', :disposition => 'inline')
|
||||
@photo.log_view
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user