jabo
January 28, 2007, 7:01pm
1
The following code from the view worked in Rails 1.1.6
<%= image_tag(url_for(:action => ‘picture’, :id => article.picture_id),
:size => “110x”, :alt => article.picture.label) %>
Now it does not work anymore (under Rails 1.2.1) : What is wrong ??
HTML code generated :
1.1.6
1.2.1
There seems to be a difference, what to do ??
jabo
January 28, 2007, 9:10pm
2
Ja Bo :
1.2.1
There seems to be a difference, what to do ??
Hi,
Suppose the image height is 50 px.
You can write :
<%= image_tag(url_for(:action => ‘picture’, :id => article.picture_id),
:size => “110x50”, :alt => article.picture.label) %>
or :
<%= image_tag(url_for(:action => ‘picture’, :id => article.picture_id),
:width => “110”, :height => ‘50’, :alt => article.picture.label) %>
– Jean-François.
–
À la renverse.
jabo
January 28, 2007, 11:45pm
3
Somehow the image is not displayed on the screen, tried your settings
but nothing helps…
jabo
January 29, 2007, 8:12pm
4
I did the following test :
TEST 1 => DOESN’T WORK !!!
<%= image_tag(url_for(:action => ‘picture’, :id => picture.id))%>
TEST 2 => DOESN’T WORK !!!
<%= link_to(image_tag(url_for(:action => ‘picture’, :id => picture.id)),
url_for(:action => ‘picture’, :id => picture.id)) %>
TEST 3 => POP-UP SHOWS IMAGE !! — IMAGE TAG DOESN’T SHOW THE SAME
IMAGE !!!
<%= link_to(image_tag(url_for(:action => ‘picture’, :id => picture.id),
:width => “200”, :alt => picture.label), url_for(:action => ‘picture’,
:id => picture.id), :popup=>true ) %>
What can be the reason for this,
Rails 1.2.1 bug ??
jabo
January 29, 2007, 9:03pm
5
Ja Bo wrote:
HTML code generated :
1.1.6
1.2.1
Not sure about the width disappearing, but you also seem to have
different controllers – “article” vs “news”. You might try either
specifying a controller in “url_for” or checking your routes.
Asa
jabo
January 29, 2007, 10:01pm
6
Sorry but that was a mistake when i retyped, in reality they are exactly
the same…
See my other example :
TEST 1 => DOESN’T WORK !!!
<%= image_tag(url_for(:action => ‘picture’, :id => picture.id))%>
TEST 2 => DOESN’T WORK !!!
<%= link_to(image_tag(url_for(:action => ‘picture’, :id => picture.id)),
url_for(:action => ‘picture’, :id => picture.id)) %>
TEST 3 => POP-UP SHOWS IMAGE !! — IMAGE TAG DOESN’T SHOW THE SAME
IMAGE !!!
<%= link_to(image_tag(url_for(:action => ‘picture’, :id => picture.id),
:width => “200”, :alt => picture.label), url_for(:action => ‘picture’,
:id => picture.id), :popup=>true ) %>
Here I have copy pasted from one view file… and I have put the three
one below another, so they have access to exactly the same
information… !!!
Asa H. wrote:
different controllers – “article” vs “news”. You might try either
Asa