1 class PicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 before_filter :authenticate_user!, :only => [:show, :credit, :search]
4 before_filter :authenticate_author, :only => [:show, :credit, :search]
5 before_filter :authenticate_admin!, :only => [:list, :browse]
8 @picture = Picture.show(params[:id], @author)
10 respond_to do |format|
11 opt = {:type => @picture.mime_type, :disposition=>"inline"}
12 format.png { send_data(@picture.restore(params[:subdir]), opt ) }
13 format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
14 format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
16 format.json { render :json => @picture.to_json}
21 @picture = Picture.show(params[:id], @author)
23 respond_to do |format|
24 format.html { render :layout => false } # show.html.erb
25 format.json { render :json => @picture.to_json}
30 @pictures = Picture.list_by_md5(params[:md5])
32 respond_to do |format|
34 format.json { render json: @pictures.to_json }
39 @pictures = Picture.all
41 respond_to do |format|
42 format.html { render layout: 'system' }# index.html.erb
43 format.json { render json: @pictures }
48 @picture = Picture.find(params[:id])
50 respond_to do |format|
51 format.html { render layout: 'system' } # show.html.erb
52 format.json { render json: @picture }