1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00

Changed back to linking directly to images as performance was crap going

through a rails controller!
This commit is contained in:
Dan Barber 2010-12-18 09:31:48 -05:00
parent 3379f36b61
commit 54ea0d9c33
4 changed files with 4 additions and 8 deletions

View File

@ -16,12 +16,8 @@ class PhotosController < ApplicationController
end
end
def show
# Log the view
def log_view
@photo = Photo.find(params[:id])
# 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

View File

@ -17,7 +17,7 @@
<% @photos.each do |photo| %>
<div class="sg-11 photo" style="background: url('<%= photo.photo.url(:size11) %>')">
<%= link_to '', photo_url(photo, :format => :jpg), :class => 'fancy' %>
<%= link_to '', photo.photo.url, :class => 'fancy' %>
</div>
<% end %>

View File

@ -8,7 +8,7 @@
<% if @photo %>
<div class="sg-17 photo" style="background: url('<%= @photo.photo.url(:size17) %>')">
<%= link_to '', photo_url(@photo, :format => :jpg), :rel => 'photo', :class => 'fancy' %>
<%= link_to '', @photo.photo.url, :class => 'fancy' %>
</div>
<% end %>

View File

@ -27,7 +27,7 @@
<% @photos.each do |photo| %>
<div class="sg-5 photo" style="background: url('<%= photo.photo.url(:size5) %>')">
<%= link_to '', photo_url(photo, :format => :jpg), :class => 'fancy' %>
<%= link_to '', photo.photo.url, :class => 'fancy' %>
</div>
<% end %>