how to display the image, which is stored in outside from the project directory.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do two things: Either you symlink to the file from within your public folder and serve the image as a static asset, or you read the image with File.read(/path/to/file) and send the binary data with send_file or send_data from within your controller.
The first option can also be slightly modified: you could catch the request for the image with a rails controller action and serve it to the browser. Additionally you could add the symlink and have the file served statically from then on.
I hope, this helps.