Ruby Forum JRuby > image_voodoo and attachment_fu

Posted by Matthew McKnight (Guest)
on 07.08.2008 23:33
(Received via mailing list)
I'm running into an error with image_voodoo 0.4 and attachment_fu, it
doesn't appear to be creating any thumbnails.  No error 
messages...except on
the view page where the public_filename is coming up nil. Any ideas as 
to
where to start debugging this?  Same thing runs okay in MRI, trying to 
move
it to JRuby.

-Matt McKnight-
LMN Solutions, Inc.
703 539 5867
matt.mcknight@lmnsolutions.com
www.lmnsolutions.com
Posted by Thomas E Enebo (Guest)
on 07.08.2008 23:49
(Received via mailing list)
Extract the image_voodoo/science commands you are using from the rails
app and make sure the methods are working properly.  Unfortunately I
had caused some regressions that I thought I corrected for 0.4.
Perhaps I missed something

-Tom

On Thu, Aug 7, 2008 at 4:32 PM, Matthew McKnight
<matt.mcknight@gmail.com> wrote:
> www.lmnsolutions.com
>



--
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: enebo@acm.org , tom.enebo@gmail.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Nick Sieger (Guest)
on 07.08.2008 23:50
(Received via mailing list)
On Thu, Aug 7, 2008 at 2:32 PM, Matthew McKnight
<matt.mcknight@gmail.com> wrote:
> I'm running into an error with image_voodoo 0.4 and attachment_fu, it
> doesn't appear to be creating any thumbnails.  No error messages...except on
> the view page where the public_filename is coming up nil. Any ideas as to
> where to start debugging this?  Same thing runs okay in MRI, trying to move
> it to JRuby.

We had this problem too, and it should be fixed in 0.4. The relevant
commit is here:

http://git.caldersphere.net/?p=image_voodoo.git;a=commit;h=dbcd18957b97eaf74c05747b70baf1acd0c79ada

To debug, I'd suggest going into the #with_image method and making
sure it's not swallowing any exceptions; that's what was preventing us
from generating thumbnails.

/Nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Matthew McKnight (Guest)
on 08.08.2008 17:00
(Received via mailing list)
I discovered that the issue is really due to attachment_fu alone, and 
not
ImageVoodoo. The issue is that it isn't able to write to specific
directories outside of the WEB-INF directory with the path_prefix 
option.
This is something of a problem as that directory gets destroyed every 
time I
deploy.  I am considering moving to the :db_file storage option instead.
Any other ideas out there?

-Matt McKnight-
LMN Solutions, Inc.
703 539 5867
matt.mcknight@lmnsolutions.com
www.lmnsolutions.com
Posted by Matthew McKnight (Guest)
on 08.08.2008 23:16
(Received via mailing list)
Solution for me was to override the full_filename method of 
attachment_fu
and to use a path that didn't begin with a slash.  full_filename 
defaults to
using RAILS_ROOT as the base directory.  Not sure why it was hard for me 
to
figure out, but ultimately an easy fix.

 def full_filename(thumbnail = nil)
          file_system_path = (thumbnail ? thumbnail_class :
self).attachment_options[:path_prefix].to_s
          File.join(file_system_path,
*partitioned_path(thumbnail_name_for(thumbnail)))
          #originally was
          #File.join(RAILS_ROOT, file_system_path,
*partitioned_path(thumbnail_name_for(thumbnail)))
 end

and then use this for path prefix
has_attachment :path_prefix => "../../../../attachments",
               :thumbnails => { :tiny => 'x50',
                                :small => 'x100',
                                :medium => 'x200',
                                :large => 'x400' }


On Fri, Aug 8, 2008 at 10:59 AM, Matthew McKnight