1 class PicturesController < ApplicationController
2 layout 'test' if Pettanr::Application.test_layout
3 before_filter :authenticate_user!, :only => [:show, :credit, :md5]
4 before_filter :authenticate_artist, :only => [:md5]
7 @picture = Picture.show(params[:id], @author)
10 opt = {:type => @picture.mime_type, :disposition=>"inline"}
11 format.png { send_data(@picture.restore(params[:subdir]), opt ) }
12 format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
13 format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
15 format.json { render :json => @picture.to_json}
20 @picture = Picture.show(params[:id], @author)
22 respond_to do |format|
23 format.html { render :layout => false } # show.html.erb
24 format.json { render :json => @picture.to_json}
29 @pictures = Picture.list_by_md5(params[:md5])
31 respond_to do |format|
33 format.json { render json: @pictures.to_json }