# Images in the database

**URL:** <https://www.ruby-forum.com/t/images-in-the-database/79149>\
**Category:** Rails\
**Created:** [December 12, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149 "2006-12-12T16:40:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/1 "2006-12-12T16:40:38Z")

</div>

Hi All,

Can someone please tell me how I can show database stored images within  
a template. I’ve managed to show them  
in a new screen with send\_data but can’t seem to find how and if it’s  
possible to show it in the template. The only thing I’ve tracked in  
different references and books  
are displaying it on a new page. So could someone tell me if I’m chasing  
ghosts?

Kind regards,  
Jeroen van Doorn

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/2 "2006-12-12T16:50:44Z")

</div>

have you thought of trying acts as attachment or acts as column?

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 5:32pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/3 "2006-12-12T17:32:46Z")

</div>

On 12/12/06, koloa [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> have you thought of trying acts as attachment or acts as column?

I think maybe Koloa meant file\_column rather than acts\_as\_column?

Both acts\_as\_attachment and file\_column make it relatively easy to  
upload  
files (images) and store as blob.

You can find them along with all the other major plugin references at  
[http://wiki.rubyonrails.com/rails/pages/Plugins](http://wiki.rubyonrails.com/rails/pages/Plugins)

Blessings,

Jeff

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 5:50pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/4 "2006-12-12T17:50:51Z")

</div>

Hello Jeroen,

2006/12/12, Jeroen van Doorn [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Can someone please tell me how I can show database stored images within  
> a template. I’ve managed to show them  
> in a new screen with send\_data but can’t seem to find how and if it’s  
> possible to show it in the template. The only thing I’ve tracked in  
> different references and books  
> are displaying it on a new page. So could someone tell me if I’m chasing  
> ghosts?

You are 95% of the way there. You need an image tag that will display  
the image. Since you already have an action that displays the image,  
you simply need to tell the browser about it.

![](https://www.ruby-forum.com/my/action/with/the/image.jpg)

## Hope that helps !

FranÃ§ois Beausoleil  
[http://blog.teksol.info/](http://blog.teksol.info/)  
[http://piston.rubyforge.org/](http://piston.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 5:34pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/5 "2006-12-12T17:34:47Z")

</div>

koloa schreef:

> have you thought of trying acts as attachment or acts as column?

Nope, I’ll look into this. Thanx!

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 5:58pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/6 "2006-12-12T17:58:56Z")

</div>

How about flex\_image

[http://beautifulpixel.textdriven.com/flex\_image/index.html](http://beautifulpixel.textdriven.com/flex_image/index.html)

I ve been using it and it is very handy to play with images.

On 12/12/06, Jeroen van Doorn [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > different references and books  
> > > Hope that helps !
> 
> >

–  
Carl-Gustaf H.

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 5:54pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/7 "2006-12-12T17:54:54Z")

</div>

Francois B. schreef:

> > ghosts?
> 
> * * *
> 
> No virus found in this incoming message.  
> Checked by AVG Free Edition.  
> Version: 7.1.409 / Virus Database: 268.15.15/581 - Release Date: 9-12-2006

Wow! I never thought of that … how stupid 🙂

Thanx!

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 6:37pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/8 "2006-12-12T18:37:00Z")

</div>

Would be another alternative, but I don’t need the extra options. So  
such a plugin would make  
my code(base) larger than nessacery. When I need to do image  
manipulation in the future, I’ll definitly will use fleximage

Kind regards,  
Jeroen

---

<div class="post-metadata">

**Author:** ![Jeroen\_van\_Doorn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/49beb7/32.png) [@Jeroen\_van\_Doorn](https://www.ruby-forum.com/u/Jeroen_van_Doorn)\
**Post date:** [December 12, 2006, 10:40pm UTC](https://www.ruby-forum.com/t/images-in-the-database/79149/9 "2006-12-12T22:40:21Z")

</div>

Is there any way to convert image type using flex\_image or do i have to  
go all the way down to RMagick? I’m anal-retentive and all my images  
must be PNGs!
