class PicturesController < ApplicationController
layout 'test' if Pettanr::TestLayout
+ before_filter :authenticate_user!, :only => [:show, :credit]
+
+ def show
+ @picture = Picture.show(params[:id])
+
+ respond_to do |format|
+ opt = {:type => @picture.mime_type, :disposition=>"inline"}
+ format.png { send_data(@picture.restore(params[:subdir]), opt ) }
+ format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
+ format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
+ format.json { render :json => @picture.to_json}
+ end
+ end
+
def credit
@picture = Picture.show(params[:id])
respond_to do |format|
- format.html # show.html.erb
- format.json { render :json => @picture.to_json(Picture.list_json_opt)}
+ format.html { render :layout => false } # show.html.erb
+ format.json { render :json => @picture.to_json}
end
end