# Attachment\_fu generates wrong public\_filename

**URL:** <https://www.ruby-forum.com/t/attachment-fu-generates-wrong-public-filename/176858>\
**Category:** Rails\
**Created:** [October 7, 2009, 6:03am UTC](https://www.ruby-forum.com/t/attachment-fu-generates-wrong-public-filename/176858 "2009-10-07T06:03:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [October 7, 2009, 6:03am UTC](https://www.ruby-forum.com/t/attachment-fu-generates-wrong-public-filename/176858/1 "2009-10-07T06:03:04Z")

</div>

Hi,

attachment\_fu generates wrong public\_filename.

> > pic.thumbnails  
> > =\> ProductPicture id: 12331, product\_id: nil, parent\_id: 12330,  
> > content\_type: “image/png”, filename: “b\_9788994035109\_mid.png”,  
> > thumbnail: “mid”, size: 16562, width: 205, height: 205, created\_at:  
> > “2009-10-05 02:43:50”, updated\_at: “2009-10-05 02:43:50”,  
> > ProductPicture id: 12332, product\_id: nil, parent\_id: 12330,  
> > content\_type: “image/png”, filename: “b\_9788994035109\_thumb.png”,  
> > thumbnail: “thumb”, size: 2300, width: 52, height: 52, created\_at:  
> > “2009-10-05 02:43:51”, updated\_at: “2009-10-05 02:43:51”
> 
> > pic  
> > ProductPicture id: 12330, product\_id: 23236, parent\_id: nil,  
> > content\_type: “image/gif”, filename: “b\_9788994035109.gif”, thumbnail:  
> > nil, size: 73990, width: 400, height: 400, created\_at: “2009-10-05  
> > 02:43:50”, updated\_at: “2009-10-05 02:43:50”
> 
> > pic.thumbnails  
> > =\> ProductPicture id: 12331, product\_id: nil, parent\_id: 12330,  
> > content\_type: “image/png”, filename: “b\_9788994035109\_mid.png”,  
> > thumbnail: “mid”, size: 16562, width: 205, height: 205, created\_at:  
> > “2009-10-05 02:43:50”, updated\_at: “2009-10-05 02:43:50”, ProductPicture  
> > id: 12332, product\_id: nil, parent\_id: 12330, content\_type: “image/png”,  
> > filename: “b\_9788994035109\_thumb.png”, thumbnail: “thumb”, size: 2300,  
> > width: 52, height: 52, created\_at: “2009-10-05 02:43:51”, updated\_at:  
> > “2009-10-05 02:43:51”
> 
> > pic.public\_filename  
> > =\> “/product\_pictures/0001/2330/b\_9788994035109.gif”
> 
> > pic.public\_filename(:mid)  
> > =\> “/product\_pictures/0001/2330/b\_9788994035109\_mid.gif”

It generates “.gif” instead of “.png” when the actual type is ‘.png’  
(gif is the parent’s type)

This works ok with my dev machine but not with my production machine.

Any idea?

Thanks.

Sam
