开发者

Rails 3 create a link to image_url and show image_url(:medium)

开发者 https://www.devze.com 2023-03-07 11:19 出处:网络
I am trying to create a link to an image @user.image_url. This wil开发者_开发百科l be the full sized image. I want the medium resized image to be shown @user.image_url(:medium). But what I also want i

I am trying to create a link to an image @user.image_url. This wil开发者_开发百科l be the full sized image. I want the medium resized image to be shown @user.image_url(:medium). But what I also want is for the @user.image_url to open in FancyBox.

My current code at the moment is:

<%= link_to image_tag @user.image_url(:medium), :style => "width:717px;height:409px" %>

This links to the Users profile page, which is what I don't want.

Please help :)


Use brackets for nesting methods

<%= link_to image_tag( @user.image_url(:medium), :style => "width:717px;height:409px"), @user.image_url %>
0

精彩评论

暂无评论...
验证码 换一张
取 消