[Sdruby] Mapping to Images Folder

Nathan Colgate Clark nathancolgate at gmail.com
Wed Feb 21 21:00:49 GMT 2007


I second Patrick.  And also, make sure you pass the path as a string:

<%= image_tag ("IMAGE-NAME.jpg") %>

or

<%= image_tag ("SUBDIRECTORY/IMAGE-NAME.jpg") %>

-Nathan

Patrick Crowley wrote:
> I recommend sticking with absolute paths. Life is always easier that way.
>
> So the correct path would be '/images/IMAGE-NAME.jpg'.  But with the 
> Rails image helper, you can leave out the images directory, like so:
>
> <%= image_tag (IMAGE-NAME.jpg) %>
>
> Too, if you are using subdirectories in /images, you can do this:
>
> <%= image_tag (SUBDIRECTORY/IMAGE-NAME.jpg) %>
>
> -- Patrick
>
>
> On Feb 21, 2007, at 12:43 pm, Kevin Burk wrote:
>
>> I'm having some difficulty with specifying image paths in my 
>> application. I have a general layout template for my model that has 
>> relative reference urls to the images (../images/IMAGE-NAME.jpg). 
>> This works for the index view, but when I invoke the show view (which 
>> lives in the same folder as the index view, and should have the same 
>> relative path for the images), the image urls are broken....the show 
>> view, when invoked from the index view wants the path of 
>> "../../images/IMAGE-NAME.jpg" to display the images in the template 
>> correctly.
>>
>> This doesn't seem to make sense to me. The model folders are all the 
>> same distance from the public/images folder. It shouldn't matter 
>> which view I invoke, right?
>>
>> How do I correct this?
>>
>> Thanks,
>>
>> Kevin Burk
> _______________________________________________
> Sdruby mailing list
> Sdruby at lists.sdruby.com
> http://lists.sdruby.com/mailman/listinfo/sdruby
>



More information about the Sdruby mailing list