aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/user_controller.rb13
-rw-r--r--app/views/user/show.rhtml5
2 files changed, 18 insertions, 0 deletions
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
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index daee89eaa..667c89597 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -38,7 +38,12 @@
</div>
<div class="single_user">
+ <p id="user_photo_on_profile">
+ <img src="<%= get_profile_photo_url(:url_name => @display_user.url_name) %>">
+ </p>
+
<h1><%=@title%></h1>
+
<p class="subtitle">
Joined WhatDoTheyKnow in <%= year_from_date(@display_user.created_at) %>
<% if !@user.nil? && @user.admin_page_links? %>