# Adding image uploads to custom extension

**URL:** <https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464>\
**Category:** Radiant CMS\
**Created:** [January 23, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464 "2009-01-23T17:06:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![littleknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@littleknown](https://www.ruby-forum.com/u/littleknown)\
**Post date:** [January 23, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464/1 "2009-01-23T17:06:55Z")

</div>

Could anyone provide some direction in adding something like this? I’m  
guessing I would have to use the attachment\_fu plugin but I’m not sure  
how to integrate this with Radiant.

---

<div class="post-metadata">

**Author:** ![littleknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@littleknown](https://www.ruby-forum.com/u/littleknown)\
**Post date:** [January 23, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464/2 "2009-01-23T17:12:40Z")

</div>

Little K. wrote:

> Could anyone provide some direction in adding something like this? I’m  
> guessing I would have to use the attachment\_fu plugin but I’m not sure  
> how to integrate this with Radiant.

Would it help to look at the code for Radiant Gallery or  
PageAttachments? Both use attachment\_fu

Cheers,  
Mohit.  
1/24/2009 | 12:11 AM.

---

<div class="post-metadata">

**Author:** ![littleknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@littleknown](https://www.ruby-forum.com/u/littleknown)\
**Post date:** [January 23, 2009, 5:17pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464/3 "2009-01-23T17:17:59Z")

</div>

Little K. wrote:

> Could anyone provide some direction in adding something like this? I’m  
> guessing I would have to use the attachment\_fu plugin but I’m not sure  
> how to integrate this with Radiant.

I recently switched one of my non-Radiant projects from attachment\_fu  
over to paperclip, and I must say I’m very pleased. I highly recommend  
it.

Sean

---

<div class="post-metadata">

**Author:** ![littleknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@littleknown](https://www.ruby-forum.com/u/littleknown)\
**Post date:** [January 23, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464/4 "2009-01-23T18:35:04Z")

</div>

Sean C. wrote:

> Little K. wrote:
> 
> > Could anyone provide some direction in adding something like this? I’m  
> > guessing I would have to use the attachment\_fu plugin but I’m not sure  
> > how to integrate this with Radiant.
> 
> I recently switched one of my non-Radiant projects from attachment\_fu  
> over to paperclip, and I must say I’m very pleased. I highly recommend  
> it.
> 
> Sean

Well I’ve tried adding paperclip to my Radiant site but I’ve hit a snag.

paperclip plugin is in vendor/plugins

### player.rb

has\_attached\_file :photo,  
:styles =\> {  
:thumb=\> “100x100#”,  
:small =\> “150x150\>”,  
:medium =\> “300x300\>”,  
:large =\> “400x400\>” }

### player/app/views/admin/edit.html.erb

\<% form\_for :player, :html =\> { :multipart =\> true } do |f|%\>

\<%= f.file\_field :photo %\>

  
\<% end %\>

The file field shows up fine, but I get this error when I try uploading  
an image:

“Validation errors occurred while processing this form…”

and underneath the browse/upload part it says:  
â€¢ could not be processed because the file does not exist.

Any ideas, Sean?

---

<div class="post-metadata">

**Author:** ![littleknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc29f/32.png) [@littleknown](https://www.ruby-forum.com/u/littleknown)\
**Post date:** [January 23, 2009, 6:56pm UTC](https://www.ruby-forum.com/t/adding-image-uploads-to-custom-extension/158464/5 "2009-01-23T18:56:59Z")

</div>

Little K. wrote:

> ### player.rb
> 
> has\_attached\_file :photo,  
> :styles =\> {  
> :thumb=\> “100x100#”,  
> :small =\> “150x150\>”,  
> :medium =\> “300x300\>”,  
> :large =\> “400x400\>” }

If I change this to just has\_attached\_file :photo, everything works,  
which leads me to believe image processing is not setup correctly on my  
machine.

I downloaded the latest ImageMagick binary from their website (dll  
version) and ran the installer but it appears that isn’t all you need to  
do? (Windows, unfortunately)
