Ruby on Rails Wednesday, September 8, 2010

Colin Law wrote:
> On 8 September 2010 21:50, Abder-Rahman Ali <lists@ruby-forum.com>
> wrote:
>>
>> <img
>> src="C:\Users\Abder-Rahman\Desktop\Research\dicom\05115014-mr-siemens-avanto-syngo-with-palette-icone.jpg"
>> />
>>
>> And, when I try this path in a browser I get the image displayed.
>
> You cannot show files on the local machine (that is C:) in a web page,
> the browser will not allow it. Usually images are put in a folder
> under the public folder of your app. For example if you put them in
> public/images then the img src should be /images/filename.jpg
>
> Colin

It seems I'm doing something wrong but not aware of it.

In the dicom_info.rb file which is attached, I made a change in the the
loop for retrieving dicom files as follows:

Dir["./public/images/dcm_files/*.dcm"].each do |dcm|
dicom_files << dcm
end

In this case, when I "View source", I get the path as follows:

<img alt="05115014-mr-siemens-avanto-syngo-with-palette-icone"
src="/images/./public/images/dcm_files/05115014-mr-siemens-avanto-syngo-with-palette-icone.jpg"
/>

Provided that I'm using:

<%= image_tag(@examination.image) %>

In "show.html.erb".

How can I overcome this path issue?
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment