This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
2008-06-27 00:13:15 -04:00
|
|
|
class Application < Merb::Controller
|
|
|
|
cattr_accessor :current_author_id
|
|
|
|
before :set_current_author_id
|
|
|
|
|
|
|
|
def logged_in?
|
|
|
|
!session[:author_id].nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_current_author_id
|
|
|
|
self.current_author_id = session[:author_id]
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_photo_version(width, height)
|
|
|
|
key = "photo_#{@photo.id}_#{width}_#{height}"
|
|
|
|
img = Cache.get(key)
|
|
|
|
|
|
|
|
File.open("#{@photo.base_directory}/#{@photo.filename}", "r") do |f|
|
|
|
|
img = Magick::Image.from_blob(f.read).first.resize_to_fit(width, height)
|
|
|
|
Cache.put(key, img)
|
|
|
|
end if img.nil?
|
|
|
|
|
|
|
|
img
|
|
|
|
end
|
2008-07-23 05:09:30 -04:00
|
|
|
|
|
|
|
def tuxconfig
|
|
|
|
Merb::Plugins.config[:tuxbliki]
|
|
|
|
end
|
2008-06-27 00:13:15 -04:00
|
|
|
end
|