Use resized/splitted PNGs instead of the original JPGs.

This commit is contained in:
Bram Senders 2010-05-28 16:32:26 +02:00
parent b10b96103b
commit 312b2ac4b5
1 changed files with 10 additions and 9 deletions

View File

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