# How to display an image that is stored on a file store outsi

**URL:** <https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581>\
**Category:** Rails\
**Created:** [July 17, 2007, 2:41am UTC](https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581 "2007-07-17T02:41:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silvy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@Silvy](https://www.ruby-forum.com/u/Silvy)\
**Post date:** [July 17, 2007, 2:41am UTC](https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581/1 "2007-07-17T02:41:37Z")

</div>

I would like know how do I display images that are stored on a file  
store outside the public folder. I will be creating these images  
outside the web application but wanted to display the images. What are  
the options available for me. I looked at the file\_column and the  
fleximage plugins. I could not figure it out. Could someone help me  
out.  
Thanks  
sm

---

<div class="post-metadata">

**Author:** ![Silvy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@Silvy](https://www.ruby-forum.com/u/Silvy)\
**Post date:** [July 17, 2007, 6:48am UTC](https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581/2 "2007-07-17T06:48:54Z")

</div>

On Jul 16, 5:40 pm, Silvy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I would like know how do I display images that are stored on a file  
> store outside the public folder. I will be creating these images  
> outside the web application but wanted to display the images. What are  
> the options available for me. I looked at the file\_column and the  
> fleximage plugins. I could not figure it out. Could someone help me  
> out.  
> Thanks  
> sm

how about:  
[http://www.bencurtis.com/archives/2006/11/serving-protected-downloads-with-rails/](http://www.bencurtis.com/archives/2006/11/serving-protected-downloads-with-rails/)  
[http://robertrevans.com/article/files-outside-public-directory](http://robertrevans.com/article/files-outside-public-directory)

---

<div class="post-metadata">

**Author:** ![Silvy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@Silvy](https://www.ruby-forum.com/u/Silvy)\
**Post date:** [July 17, 2007, 8:15am UTC](https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581/3 "2007-07-17T08:15:59Z")

</div>

i would like to know whethere u r storing u r image in database with  
binary format or not,if u r storing the image in binary format.to  
display them in u r application u have to write in controller, to  
convert the stored binary format to original image

---

<div class="post-metadata">

**Author:** ![Silvy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7ea924/32.png) [@Silvy](https://www.ruby-forum.com/u/Silvy)\
**Post date:** [July 17, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/how-to-display-an-image-that-is-stored-on-a-file-store-outsi/109581/4 "2007-07-17T15:10:17Z")

</div>

Thanks for the replies. I wanted to store the actual images in the  
file store outside the public folder. But have references to these  
images in the database. I will be pre-rendering these images in  
different formats. Basically I wanted to traverse an hierarchical tree  
menu and at the end of the leaf when further branches are not there, I  
wanted to display these images as thumbnails. When clicked on the  
thumbnail, I would like to show the actual image. Also wanted to  
implements the REST style routing.

controller

def index  
menu= Menu.find(params[:menu\_id])  
@catalogues = Catalogue.find(:all, :conditions =\>  
“parent\_id=‘#{menu.id}’”)  
if @catalogues == []  
@contents= Catalogue.find\_content\_for\_the\_catalogue(menu.id)  
end  
respond\_to do |format|  
format.html # index.rhtml  
format.xml { render :xml =\> @catalogues.to\_xml }  
end  
end

View

* * *

\<% if @catalogues != [] %\>  
\<% for catalogue in @catalogues %\>  
  
\<%= link\_to catalogue.name, catalogues\_path(catalogue) %\>  
  
\<% end %\>  
\<% else %\>  
  
\<% @contents.contents.each do |content| %\>  
  
\<%= link\_to(image\_tag(“images/50x50/#{content.name  
+”\_50X50"}.png", :border =\> 1), {:controller =\> ‘contents’, :action  
=\>“show”, :id=\>content.id})%\>  
  
\<% end %\>  
  
\<% end %\>

I would like to display these images from the file store.  
Thanks  
Silvy

On Jul 16, 11:14 pm, seeram\_theprince [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
