Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v1.2.6) is shown here.
link_image_to(src, options = {}, html_options = {}, *parameters_for_method_reference)
public
DEPRECATED. It is reccommended to use the AssetTagHelper::image_tag within
a link_to method
to generate a linked image.
link_to(image_tag("rss", :size => "30x45", :border => 0), "http://www.example.com")
Show source
def link_image_to(src, options = {}, html_options = {}, *parameters_for_method_reference)
image_options = { "src" => src.include?("/") ? src : "/images/#{src}" }
image_options["src"] += ".png" unless image_options["src"].include?(".")
html_options = html_options.stringify_keys
if html_options["alt"]
image_options["alt"] = html_options["alt"]
html_options.delete "alt"
else
image_options["alt"] = src.split("/").last.split(".").first.capitalize
end
if html_options["size"]
image_options["width"], image_options["height"] = html_options["size"].split("x")
html_options.delete "size"
end
if html_options["border"]
image_options["border"] = html_options["border"]
html_options.delete "border"
end
if html_options["align"]
image_options["align"] = html_options["align"]
html_options.delete "align"
end
link_to(tag("img", image_options), options, html_options, *parameters_for_method_reference)
end