Kittenify-Rails lets you easily swap out your placeholder images in from placehold it with kittens via a view helper. Sexy hotness. And seriously cute.
Kittenify-Rails lets you easily swap out your placeholder images in from placehold it with kittens via a view helper. Sexy hotness. And seriously cute. |
module ApplicationHelper | |
def hold_it(width, height, text = "") | |
text = text.gsub(/\s/, '+') | |
if ENV["KITTENIFY"].to_i == 1 | |
url = kitten_it(width, height, text) | |
else | |
url = placehold_it(width, height, text) | |
end | |
image_tag url, size: "#{width}x#{height}" | |
end | |
def placehold_it(width, height, text = "") | |
"http://placehold.it/#{width}x#{height}&text=#{text}+(#{width}x#{height})" | |
end | |
def kitten_it(width, height, text = "", grayscale = false) | |
"http://placekitten.com/#{grayscale ? "g/" : ""}#{width}/#{height}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment