top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Path to images on another app using Rails?

+1 vote
361 views

I am using RoR and one of my apps drives the others and stores pictures that the others use.
Both apps are on the same server How do I build a link to the image on the other app?

posted Aug 10, 2017 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Try image_tag

Similar Questions
0 votes

I need to upload multiple images at a time. How can I upload let me know please.

+2 votes

How to convert utc time to a time in a particular time zone. As I need to display local time of Timezone(-05:00).

+1 vote

I've put my favicon into app/assets/images and include in my header

The favicon is correctly recognized by the browser, so it works perfectly. When viewing the source code, I see to my surprise that the following HTML code is generated:

Aside from the MIME type (I had expected that rails would generate image/jpeg), what really puzzles me is the path. The file is definitely in /assets/images, not in /assets . How can the browser locate the file?

+2 votes

I am trying to develop an app to manage media files I have a folder with pictures, audio and video files.

I am using Dir.glob to list the directory in my controller and in my views I am using match with regular expressions to test if the file ends in mp3 jpg mp4 3gp wav etc ... the code I wrote seems to almost work The variable @file is passed on from the controller and here is my view.

Is this a sensible way of trying to do this?

<% if @file.match("mp4") %>
 <video width="320" height="240" controls>
  <source src= <%= @file %> type="video/mp4">
 </video> 
<% elsif @file.match("mp3") %>
 <audio controls preload="auto">
  <source src = <%= @file %> >
 </audio>
<% elsif @file.match("jpg") %>
 <img src= "<%= @file %>">
<% end %>
...