attachment_fu plugin

0 views
Skip to first unread message

bmcc

unread,
Oct 22, 2009, 1:40:35 PM10/22/09
to Orlando Ruby Users Group Discussion
Hello Everyone,

I have been slowly getting stronger with ruby and rails, but ofcourse
the deeper I dig the more problems arrise.

I have been using the plugin attachment_fu to handle uploading,
thumbnail creation, and re-sizing of images. I created a scaffold and
for a model called VillaPic (added has_attachment). I didnt touch the
code in the edit action. When I upload a VillaPic I have attachment_fu
create a thumnail with the same name as the original file with _thumb
appended to the end. My issue is when I change (action => 'edit') the
name of the main file and hit update it does not update the
thumbnail's name to reflect the changes unless I pretend to edit the
file again and hit update without actually changing anything.

I tried to call these functions in the controller an the model but I
am having a problem with the parameters and such so I dont even know
if Im headed in the right direction: find_or_initialize_thumbnail
(file_name_suffix) and create_or_update_thumbnail(temp_file,
file_name_suffix, *size). I was just wondering if anyone ever had an
issue in this area and how you solved it.

I didnt post any code because everything is working fine but this so
there really isnt nothing to analyze. If you have ran accross this
issue with attachment_fu Im sure you will know what Im talking about
without any code. If not thats cool, maybe you might want to check out
the plugin when you have some free time.


Thanks,

Barry

Greg Pederson

unread,
Oct 22, 2009, 3:17:09 PM10/22/09
to orug-di...@googlegroups.com
Is the name field being created by the plugin or in the new form?  If it's created by the plugin maybe make sure your model/controller code isn't taking precedent over the plugin edit functionality....just a thought.  You may need to declare the name attribute in your model??? 
attr_accessible :name

Just a long shot guess.

If you can't work it out or find yourself spending too much time you might consider using paperclip as it's really easy to integrate...IMHO

http://ruby-toolbox.com/categories/rails_file_uploads.html

Greg
--
Greg Pederson
Founder and Technical Director

407-641-0327 office

@gregpederson twitter
Nsight Development, LLC.
www.NsightDevelopment.com

Quis custodiet ipsos custodes

Anthony Eden

unread,
Oct 22, 2009, 3:20:46 PM10/22/09
to orug-di...@googlegroups.com
I'll second using Paperclip, if that's an option. Just keep in mind
that if you ever have any reasonable amount of traffic that uploads
files then trying to process images inline is probably not a good
idea.

Anthony
--
GMU/IT d- s: a32 C++(++++)$ UL@ P--- L+(++) !E W+++$ !N o? K? w--- !O
M++ V PS+ PE Y PGP t+ !5 X- R tv b++ DI+ D++ G- e++ h---- r+++ y++++**

http://anthony.mp

bmcc

unread,
Oct 25, 2009, 7:30:22 PM10/25/09
to Orlando Ruby Users Group Discussion
Thanks for the responses everyone.

"attr_accessible :name" didnt work. I thought it would but it didnt.
So I basically hardcoded a work-around in the update action. Since
there is only one thumbnail per picture, after I update the picture I
do a find for its thumbnail and update it with the same information.

Its not a big deal Im sure I will figure it out in due time. I am
going to checkout Paperclip on my next rails project thanks for the
heads up.

Take Care

Barry



On Oct 22, 3:20 pm, Anthony Eden <anthonye...@gmail.com> wrote:
> I'll second using Paperclip, if that's an option. Just keep in mind
> that if you ever have any reasonable amount of traffic that uploads
> files then trying to process images inline is probably not a good
> idea.
>
> Anthony
>
>
>
>
>
> On Thu, Oct 22, 2009 at 9:17 AM, Greg Pederson <greg.peder...@gmail.com> wrote:
> > Is the name field being created by the plugin or in the new form?  If it's
> > created by the plugin maybe make sure your model/controller code isn't
> > taking precedent over the plugin edit functionality....just a thought.  You
> > may need to declare the name attribute in your model???
> > attr_accessible :name
>
> > Just a long shot guess.
>
> > If you can't work it out or find yourself spending too much time you might
> > consider using paperclip as it's really easy to integrate...IMHO
>
> >http://ruby-toolbox.com/categories/rails_file_uploads.html
>
> > Greg
>
> http://anthony.mp- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages