From ac69b8f9f86b6703fc882119aa04b8707e062dab Mon Sep 17 00:00:00 2001 From: Francis Irving Date: Wed, 14 Jul 2010 14:34:18 +0100 Subject: Show photo on profile page --- app/controllers/user_controller.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app/controllers/user_controller.rb') diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 277d0cd73..b45b98001 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -378,6 +378,19 @@ class UserController < ApplicationController redirect_to user_url(@user) end + def get_profile_photo + @display_user = User.find(:first, :conditions => [ "url_name = ? and email_confirmed = ?", params[:url_name], true ]) + if !@display_user + raise "user not found, url_name=" + params[:url_name] + end + if !@display_user.profile_photo + raise "user has no profile photo, url_name=" + params[:url_name] + end + + response.content_type = "image/png" + render_for_text(@display_user.profile_photo.data) + end + private # Decide where we are going to redirect back to after signin/signup, and record that -- cgit v1.2.3