Use resized/splitted PNGs instead of the original JPGs.
This commit is contained in:
parent
b10b96103b
commit
312b2ac4b5
|
@ -54,7 +54,7 @@ module Anne::Helpers
|
||||||
|
|
||||||
def next_image
|
def next_image
|
||||||
all_images =
|
all_images =
|
||||||
Pathname.glob(IMAGE_DIR + "*.jpg").map { |img| img.basename.to_s }
|
Pathname.glob(IMAGE_DIR + "*-l.png").map { |img| img.basename.to_s.sub("-l.png", "") }
|
||||||
all_votes =
|
all_votes =
|
||||||
Anne::Models::Vote.find(:all,
|
Anne::Models::Vote.find(:all,
|
||||||
:conditions => { :user_id => @state["user"].id })
|
:conditions => { :user_id => @state["user"].id })
|
||||||
|
@ -101,8 +101,8 @@ module Anne::Controllers
|
||||||
end
|
end
|
||||||
|
|
||||||
def post
|
def post
|
||||||
choice = if @input.left then "left"
|
choice = if @input["left.x"] then "left"
|
||||||
elsif @input.right then "right"
|
elsif @input["right.x"] then "right"
|
||||||
else raise "no choice made!"
|
else raise "no choice made!"
|
||||||
end
|
end
|
||||||
vote = Anne::Models::Vote.create( :user_id => @state["user"].id,
|
vote = Anne::Models::Vote.create( :user_id => @state["user"].id,
|
||||||
|
@ -115,7 +115,7 @@ module Anne::Controllers
|
||||||
class ImageX
|
class ImageX
|
||||||
def get(file)
|
def get(file)
|
||||||
unless file =~ /\.\./
|
unless file =~ /\.\./
|
||||||
headers["Content-Type"] = "image/jpeg"
|
headers["Content-Type"] = "image/png"
|
||||||
headers["X-Sendfile"] = (IMAGE_DIR + file).to_s
|
headers["X-Sendfile"] = (IMAGE_DIR + file).to_s
|
||||||
else
|
else
|
||||||
@status = 403
|
@status = 403
|
||||||
|
@ -230,13 +230,14 @@ module Anne::Views
|
||||||
|
|
||||||
def vote(image, progress = 0)
|
def vote(image, progress = 0)
|
||||||
h2 "Welk beeld is ruimtelijker?"
|
h2 "Welk beeld is ruimtelijker?"
|
||||||
# FIXME: resize all images
|
# FIXME: offset the two images in the same way as in the original
|
||||||
# FIXME: split all images in two parts and make it possible two select an image.
|
# composited image.
|
||||||
img :src => R(ImageX, image), :width => "80%"
|
|
||||||
form :action => R(Vote), :method => :post do
|
form :action => R(Vote), :method => :post do
|
||||||
input :type => "hidden", :name => "image", :value => image
|
input :type => "hidden", :name => "image", :value => image
|
||||||
input :type => "submit", :name => "left", :value => "Links"
|
input :type => "image", :src => R(ImageX, "#{image}-l.png"), :name => "left"
|
||||||
input :type => "submit", :name => "right", :value => "Rechts"
|
input :type => "image", :src => R(ImageX, "#{image}-r.png"), :name => "right"
|
||||||
|
#input :type => "submit", :name => "left", :value => "Links"
|
||||||
|
#input :type => "submit", :name => "right", :value => "Rechts"
|
||||||
end
|
end
|
||||||
# FIXME: make a nice div with two spans of the following.
|
# FIXME: make a nice div with two spans of the following.
|
||||||
p "Woep, je bent al op #{progress}%!"
|
p "Woep, je bent al op #{progress}%!"
|
||||||
|
|
Reference in New Issue