From 54ea0d9c33f00804d487ee99c5bc22e643285162 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Sat, 18 Dec 2010 09:31:48 -0500 Subject: [PATCH] Changed back to linking directly to images as performance was crap going through a rails controller! --- app/controllers/photos_controller.rb | 6 +----- app/views/categories/index.html.erb | 2 +- app/views/pages/index.html.erb | 2 +- app/views/photos/index.html.erb | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 13f8cc5..81305c0 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -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 diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb index 0515e4f..057d69d 100644 --- a/app/views/categories/index.html.erb +++ b/app/views/categories/index.html.erb @@ -17,7 +17,7 @@ <% @photos.each do |photo| %>
- <%= link_to '', photo_url(photo, :format => :jpg), :class => 'fancy' %> + <%= link_to '', photo.photo.url, :class => 'fancy' %>
<% end %> diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb index e8249d5..7ce51b2 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/pages/index.html.erb @@ -8,7 +8,7 @@ <% if @photo %>
- <%= link_to '', photo_url(@photo, :format => :jpg), :rel => 'photo', :class => 'fancy' %> + <%= link_to '', @photo.photo.url, :class => 'fancy' %>
<% end %> diff --git a/app/views/photos/index.html.erb b/app/views/photos/index.html.erb index 368cfc9..7aaca02 100644 --- a/app/views/photos/index.html.erb +++ b/app/views/photos/index.html.erb @@ -27,7 +27,7 @@ <% @photos.each do |photo| %>
- <%= link_to '', photo_url(photo, :format => :jpg), :class => 'fancy' %> + <%= link_to '', photo.photo.url, :class => 'fancy' %>
<% end %>