Forum: Ruby on Rails rhtml image trouble

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F3756de5b120eaa1abfd1f913b35541b?d=identicon&s=25 raj (Guest)
on 2007-05-11 22:42
<img src="public/images/mainimage.jpg" width="250" height="250">

I have this line in rhtml layout file of my controller file and the
image is in public/images/

the image is not displayed.

please help.
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2007-05-11 22:56
(Received via mailing list)
On May 11, 2007, at 4:42 PM, raj wrote:
> <img src="public/images/mainimage.jpg" width="250" height="250">
>
> I have this line in rhtml layout file of my controller file and the
> image is in public/images/
>
> the image is not displayed.
>
> please help.

Try:

<img src="/images/mainimage.jpg" width="250" height="250">

Or in Rails:

<%= image_tag 'mainimage.jpg', :size => '250x250' %>

-Rob

Rob Biedenharn    http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
F3756de5b120eaa1abfd1f913b35541b?d=identicon&s=25 raj (Guest)
on 2007-05-12 01:21
Thank you that worked.
This topic is locked and can not be replied to.