GithubHelp home page GithubHelp logo

technoweenie / attachment_fu Goto Github PK

View Code? Open in Web Editor NEW
1.0K 10.0 306.0 1008 KB

Treat an ActiveRecord model as a file attachment, storing its patch, size, content type, etc.

Home Page: http://weblog.techno-weenie.net

License: MIT License

Ruby 100.00%

attachment_fu's Introduction

attachment-fu
=============

attachment_fu is a plugin by Rick Olson (aka technoweenie <http://techno-weenie.net>) and is the successor to acts_as_attachment.  To get a basic run-through of its capabilities, check out Mike Clark's tutorial <http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu>.


attachment_fu functionality
===========================

attachment_fu facilitates file uploads in Ruby on Rails.  There are a few storage options for the actual file data, but the plugin always at a minimum stores metadata for each file in the database.

There are four storage options for files uploaded through attachment_fu:
  File system
  Database file
  Amazon S3
  Rackspace (Mosso) Cloud Files

Each method of storage many options associated with it that will be covered in the following section.  Something to note, however, is that the Amazon S3 storage requires you to modify config/amazon_s3.yml, the Rackspace Cloud Files storage requires you to modify config/rackspace_cloudfiles.yml, and the Database file storage requires an extra table.


attachment_fu models
====================

For all three of these storage options a table of metadata is required.  This table will contain information about the file (hence the 'meta') and its location.  This table has no restrictions on naming, unlike the extra table required for database storage, which must have a table name of db_files (and by convention a model of DbFile).
  
In the model there are two methods made available by this plugins: has_attachment and validates_as_attachment.

has_attachment(options = {})
  This method accepts the options in a hash:
    :content_type     # Allowed content types.
                      # Allows all by default.  Use :image to allow all standard image types.
    :min_size         # Minimum size allowed.
                      # 1 byte is the default.
    :max_size         # Maximum size allowed.
                      # 1.megabyte is the default.
    :size             # Range of sizes allowed.
                      # (1..1.megabyte) is the default.  This overrides the :min_size and :max_size options.
    :resize_to        # Used by RMagick to resize images.
                      # Pass either an array of width/height, or a geometry string.
    :thumbnails       # Specifies a set of thumbnails to generate.
                      # This accepts a hash of filename suffixes and RMagick resizing options.
                      # This option need only be included if you want thumbnailing.
    :thumbnail_class  # Set which model class to use for thumbnails.
                      # This current attachment class is used by default.
    :path_prefix      # Path to store the uploaded files in.
                      # Uses public/#{table_name} by default for the filesystem, and just #{table_name} for the S3 and Cloud Files backend.  
                      # Setting this sets the :storage to :file_system.
    :partition        # Whether to partiton files in directories like /0000/0001/image.jpg. Default is true. Only applicable to the :file_system backend.
    :storage          # Specifies the storage system to use..
                      # Defaults to :db_file.  Options are :file_system, :db_file, :s3, and :cloud_files.
    :cloudfront       # If using S3 for storage, this option allows for serving the files via Amazon CloudFront.
                      # Defaults to false.
    :processor        # Sets the image processor to use for resizing of the attached image.
                      # Options include ImageScience, Rmagick, and MiniMagick.  Default is whatever is installed.
    :uuid_primary_key # If your model's primary key is a 128-bit UUID in hexadecimal format, then set this to true.
    :association_options  # attachment_fu automatically defines associations with thumbnails with has_many and belongs_to. If there are any additional options that you want to pass to these methods, then specify them here.
    

  Examples:
    has_attachment :max_size => 1.kilobyte
    has_attachment :size => 1.megabyte..2.megabytes
    has_attachment :content_type => 'application/pdf'
    has_attachment :content_type => ['application/pdf', 'application/msword', 'text/plain']
    has_attachment :content_type => :image, :resize_to => [50,50]
    has_attachment :content_type => ['application/pdf', :image], :resize_to => 'x50'
    has_attachment :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
    has_attachment :storage => :file_system, :path_prefix => 'public/files'
    has_attachment :storage => :file_system, :path_prefix => 'public/files', 
                   :content_type => :image, :resize_to => [50,50], :partition => false
    has_attachment :storage => :file_system, :path_prefix => 'public/files',
                   :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
    has_attachment :storage => :s3
    has_attachment :store => :s3, :cloudfront => true
    has_attachment :storage => :cloud_files

validates_as_attachment
  This method prevents files outside of the valid range (:min_size to :max_size, or the :size range) from being saved.  It does not however, halt the upload of such files.  They will be uploaded into memory regardless of size before validation.
  
  Example:
    validates_as_attachment


attachment_fu migrations
========================

Fields for attachment_fu metadata tables...
  in general:
    size,         :integer  # file size in bytes
    content_type, :string   # mime type, ex: application/mp3
    filename,     :string   # sanitized filename
  that reference images:
    height,       :integer  # in pixels
    width,        :integer  # in pixels
  that reference images that will be thumbnailed:
    parent_id,    :integer  # id of parent image (on the same table, a self-referencing foreign-key).
                            # Only populated if the current object is a thumbnail.
    thumbnail,    :string   # the 'type' of thumbnail this attachment record describes.  
                            # Only populated if the current object is a thumbnail.
                            # Usage:
                            # [ In Model 'Avatar' ]
                            #   has_attachment :content_type => :image, 
                            #                  :storage => :file_system, 
                            #                  :max_size => 500.kilobytes,
                            #                  :resize_to => '320x200>',
                            #                  :thumbnails => { :small => '10x10>',
                            #                                   :thumb => '100x100>' }
                            # [ Elsewhere ]
                            # @user.avatar.thumbnails.first.thumbnail #=> 'small'
  that reference files stored in the database (:db_file):
    db_file_id,   :integer  # id of the file in the database (foreign key)
    
Field for attachment_fu db_files table:
  data, :binary # binary file data, for use in database file storage


attachment_fu views
===================

There are two main views tasks that will be directly affected by attachment_fu: upload forms and displaying uploaded images.

There are two parts of the upload form that differ from typical usage.
  1. Include ':multipart => true' in the html options of the form_for tag.
    Example:
      <% form_for(:attachment_metadata, :url => { :action => "create" }, :html => { :multipart => true }) do |form| %>
      
  2. Use the file_field helper with :uploaded_data as the field name.
    Example:
      <%= form.file_field :uploaded_data %>

Displaying uploaded images is made easy by the public_filename method of the ActiveRecord attachment objects using file system, s3, and Cloud Files storage.

public_filename(thumbnail = nil)
  Returns the public path to the file.  If a thumbnail prefix is specified it will return the public file path to the corresponding thumbnail.
  Examples:
    attachment_obj.public_filename          #=> /attachments/2/file.jpg
    attachment_obj.public_filename(:thumb)  #=> /attachments/2/file_thumb.jpg
    attachment_obj.public_filename(:small)  #=> /attachments/2/file_small.jpg

When serving files from database storage, doing more than simply downloading the file is beyond the scope of this document.


attachment_fu controllers
=========================

There are two considerations to take into account when using attachment_fu in controllers.

The first is when the files have no publicly accessible path and need to be downloaded through an action.

Example:
  def readme
    send_file '/path/to/readme.txt', :type => 'plain/text', :disposition => 'inline'
  end
  
See the possible values for send_file for reference.


The second is when saving the file when submitted from a form.
Example in view:
 <%= form.file_field :attachable, :uploaded_data %>

Example in controller:
  def create
    @attachable_file = AttachmentMetadataModel.new(params[:attachable])
    if @attachable_file.save
      flash[:notice] = 'Attachment was successfully created.'
      redirect_to attachable_url(@attachable_file)     
    else
      render :action => :new
    end
  end

attachement_fu scripting
====================================

You may wish to import a large number of images or attachments. 
The following example shows how to upload a file from a script. 

#!/usr/bin/env ./script/runner

# required to use ActionController::TestUploadedFile 
require 'action_controller'
require 'action_controller/test_process.rb'

path = "./public/images/x.jpg"

# mimetype is a string like "image/jpeg". One way to get the mimetype for a given file on a UNIX system
# mimetype = `file -ib #{path}`.gsub(/\n/,"")

mimetype = "image/jpeg"

# This will "upload" the file at path and create the new model.
@attachable = AttachmentMetadataModel.new(:uploaded_data => ActionController::TestUploadedFile.new(path, mimetype))
@attachable.save

attachment_fu's People

Contributors

aka47 avatar crafterm avatar djones avatar drnic avatar eadz avatar erkki avatar foobarwidget avatar francois avatar gtd avatar joergbattermann avatar minter avatar nbibler avatar nicksieger avatar ralph avatar redinger avatar rmm5t avatar rolfb avatar rsanheim avatar segfault avatar solum13 avatar technoweenie avatar zsombor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attachment_fu's Issues

bug in ImageScience when it processes .gifs

In ImageScience, gif thumbnails are saved in png

In
http://github.com/technoweenie/attachment_fu/blob/master/lib/technoweenie/attachment_fu.rb

There is a bug in line
# Gets the thumbnail name for a filename. 'foo.jpg' becomes 'foo_thumbnail.jpg'
def thumbnail_name_for(thumbnail = nil)
return filename if thumbnail.blank?
ext = nil
basename = filename.gsub /.\w+$/ do |s|
ext = s; ''
end
# ImageScience doesn't create gif thumbnails, only pngs
ext.sub!(/gif$/, 'png') if attachment_options[:processor] == "ImageScience"
"#{basename}_#{thumbnail}#{ext}"
end

attachment_options[:processor]
returns a symbol and the comparison fails

it works if you do...

ext.sub!(/gif$/, 'png') if attachment_options[:processor].to_s == "ImageScience"

Switching between different machines

Problem/Scenario:
I have a development environment on my local machine. Everything works fine.
I deploy the application to other machine in production mode. Resizing image does not work and I don't have a clue why. I have no imagemagick installed but since I am in production mode I will not see this error.

Solution? This code:
# Log the failure to load the image.
logger.debug("Exception working with image: #{$!}")
Should be changed to WARN:
# Log the failure to load the image.
logger.warn("Exception working with image: #{$!}")

Solved Rails 3.0.3 temp_file size problem. Maybe this needs a more solid fix

Here's the new Technoweenie::AttachmentFu::InstanceMethods.temp_path method code that nails down this problem:

def temp_path
    p = temp_paths.first

    if p.is_a?(ActionDispatch::Http::UploadedFile) # Rails 3.0.3 compatability fix
      p.tempfile.path
    else
      p.respond_to?(:path) ? p.path : p.to_s
    end
end

It appears, that attachment_fu expected temp_paths.first to be a File, but with Rails 3.0.3 it turns out to be an ctionDispatch::Http::UploadedFile, which is wrapped around a file and won't provide 'path' accessor directly.

Form with "f.file_field :uploaded_data" causes 500 internal server error

I followed a simple example to upload a file. When i add to the upload form the field <%= f.file_field :uploaded_data %>, and submit the form (with or without an image), i get an error message in the web page:
500 Internal Server Error
If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.

On the server log i get an error message:
TypeError (can't convert nil into Integer):
I am on rails 3.0.5 and Ruby 1.9.2

Validating image dimensions before save

When the image gets saved, the height and width of the image get saved in the model correctly. I have a requirement where I need to validate the dimension of the image. It has to be of precisely the same dimensions. But when I try to access height or width before save, it gives me nil.

Is there any way where I can achieve this? I can't find it.

No such file to load -- ftools

I get this error when using attachment_fu with Ruby 1.9.1p378 and Rails Rails 2.3.5.
Any ideas on how to fix this problem ?

batch import does not create thumbnails and does not take into account MetaModel attachment options

When importing images in batch from local directory, some of the meta model options for has_attachment are not taken into account.

MetaModel Picture:
class Picture < ActiveRecord::Base
belongs_to :webdata

acts_as_list :scope => :webdata
has_attachment :content_type => :image,
:storage => :file_system,
:path_prefix => 'public/pictures',
:partition => false,
:max_size => 5.megabytes,
:resize_to => '960x640>',
:thumbnails => {
:iP4 => '160',
:iP => '80'
}

validates_as_attachment

end

in a rake task:

picture = Picture.new(
:uploaded_data => ActionController::TestUploadedFile.new(tmpfile_path, content_type)
)

Pictures are imported but size constraint and thumbnails options are not taken into account, no thumbnails are created and pictures are not resized.

displaying pdf attachment inline, in the view (problem with browsers on Windows)

This is not an attachment_fu issue, I think, but somebody here may know what the problem is.

I have my attachments in the cloud. When I want to display an attached file in my rails app's view, I write (in the view, haml):

= image_tag @model.attachment.public_filename

and the attachment (image or pdf) is neatly displayed inline in the view.

But this only works on a Mac. The same page accessed from a browser running on Windows displays broken image holder for pdf attachments (no problem with images).

Why is that? How to fix that? How do I display a pdf attachment inline in a browser on Windows? I've searched around and found nothing. So, I post the question here.

Suggestion and help appreciated,
Thanks,
martin

Size restrictions are not properly applied to separate thumbnail class.

I have two classes, one which manages the "child" images and one for the "parent" images.

In the parent image class I have:
class Photo < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:size => 1..5.megabytes,
:thumbnails => { :thumb => 'c100x100' },
:thumbnail_class => ChildPhoto,
:path_prefix => "Photos"

  validates_as_attachment
end

And in the child class:
class ChildPhoto < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:path_prefix => "Photos",

  validates_as_attachment
end

I've removed the :belongs_to stuff because mine is quite funky and gets in the way of reading :)

Anyways, this is code for a friend's photography portfolio and so obviously the images can be quite large when first uploaded. The issue, though, is that I left the size parameter as the default for the child class as I figured thumbnails wouldn't be very large at all. However, the image size is checked before the resize operation and so the child class throws its toys out of the pram because it has an image that is larger than it is expecting. Is this expected behavior? The solution, obviously, is to also apply the :size option to the ChildImage class, but this feels wrong to me...

Tempfiles in tmp/attachment_fu are not proactively deleted

Attachment_fu generates lots of tempfiles in tmp/attachment_fu, which are never deleted until the process exits. This is a problem with long running processes, which can generate tons of tempfiles. When attachment_fu is done with a tempfile, it should be proactively deleted in order to conserve disk space.

Error when attempting to install attachment_fu using bundler

Hello all,

I am trying to install attachment_fu on a rails 3 app using bundler and I am getting the following error:

Could not find gem 'attachment_fu (>= 0) ruby' in git://github.com/technoweenie/attachment_fu.git (at master).
Source does not contain any versions of 'attachment_fu (>= 0) ruby'

My gem file has the following line in it:

gem 'attachment_fu', :git => "git://github.com/technoweenie/attachment_fu.git", :branch => 'master'

Can anyone tell me what I need to change to get attachment_fu to install properly?

in Windows, uploading to Amazon S3 and Rackspace Cloud Files fails

You have to change the save_to_storage from s3 and rackspace backends so instead of:
(temp_path ? File.open(temp_path) : temp_data)
you do:
(temp_path ? File.open(temp_path, "rb") : temp_data)

Example for rackspace:

      def save_to_storage
        if save_attachment?
          @object = @@container.create_object(full_filename)
          @object.write((temp_path ? File.open(temp_path, "rb") : temp_data))
        end

        @old_filename = nil
        true
      end

attachment_fu + ruby 1.9.1

Something goes wrong when I upload:

/!\ FAILSAFE /!\ 2010-09-03 15:21:19 +0200
Status: 500 Internal Server Error
can't convert nil into Integer
/files/sources/rails/customer-service/vendor/plugins/attachment_fu/init.rb:7:in sprintf' /files/sources/rails/customer-service/vendor/plugins/attachment_fu/init.rb:7:inmake_tmpname'
/usr/lib64/ruby/1.9.1/tmpdir.rb:132:in create' /usr/lib64/ruby/1.9.1/tempfile.rb:134:ininitialize'
/usr/lib64/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/utils.rb:486:in new' /usr/lib64/ruby/gems/1.9.1/gems/rack-1.1.0/lib/rack/utils.rb:486:inblock in parse_multipart'
[...]

On ruby 1.8 is ok.

Mongrel_rails prefix

when mongrel_rails is started in with a prefix (such as --prefix=/myapp) object.public_filename will not go to the correct url path. The base url seems to be getting lost as public_filename will not return the rails base url.

Files not properly "required"

When using attachment_fu alongside Yard, launching the Rails server throws an error that constant Technoweenie::AttachmentFu can not be found. It is failing on:

ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)

When using attachment_fu alongside Shoulda, the same error is thrown when attempting to run tests.

In "init.rb", only TempFile and Geometry are required. Adding the following resolves the aforementioned issue, and should be added to the repo:

require 'technoweenie/attachment_fu'
Dir.glob(File.join(File.dirname(__FILE__), 'lib/backends/*.rb')).each {|f| require f }
Dir.glob(File.join(File.dirname(__FILE__), 'lib/processors/*.rb')).each {|f| require f }

Server Setting Missing In Config File

I was getting a connection refused error while using attachment_fu with S3. I found that while in the 's3sh' console the server variable gets set to 's3.amazonaws.com', within my app it was nil. Setting this in the amazon_s3.yml file solved the problem:

server: s3.amazonaws.com

This should probably be included in the config example.

:resize_to

It doesn't seem to work with image_magick. True?
thanks,
martin

TypeError (can't convert nil into Integer):

I followed a simple example to upload a file. When i add to the upload form the field <%= f.file_field :uploaded_data %>, and submit the form (with or without an image), i get an error message in the web page:
500 Internal Server Error

On the server log i get an error message:TypeError (can't convert nil into Integer):

I am on rails 3.0.5 and Ruby 1.9.2 on Windows 7

I used the sample code at:http://clarkware.com/blog/2007/02/24/file-upload-fu

S3/Cloud Creates wrong public path when using separate thumbnail class

If you have a separate thumbnail class the wrong public_filename is show when using S3/Cloud.

Examples:

photo = Photo.find(328)
=> #<Photo id: 328, parent_id: nil, size: 2078, width: 33, height: 48, content_type: "image/gif", filename: "Hollowbody_1.gif", thumbnail: nil, caption: nil, position: 43, picturable_id: 14, picturable_type: "Topic", created_at: "2010-07-30 15:05:02", updated_at: "2010-07-30 15:05:03">

File System:

photo.public_filename
=> "/photos/0000/0328/Hollowbody_1.gif"
photo.public_filename(:thumb)
=> "/thumbnails/0000/0328/Hollowbody_1_thumb.gif"

S3/Cloud:

photo.public_filename
=> "http://XXX.cloudfront.net/photos/328/Hollowbody_1.gif"
photo.public_filename(:thumb)
=> "http://XXX.cloudfront.net/photos/328/Hollowbody_1_thumb.gif"

Here is a patch that fixes it:

From 130b83b534fbdb03f15a5cc06c46c65d8e1629a2 Mon Sep 17 00:00:00 2001
From: Michael Petnuch [email protected]
Date: Fri, 30 Jul 2010 11:59:50 -0400
Subject: [PATCH] Correct path when using thumbnail class with S3/Cloud


.../attachment_fu/backends/cloud_file_backend.rb | 7 ++++---
.../attachment_fu/backends/s3_backend.rb | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb b/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb
index 214ab27..8d043de 100644
--- a/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb
+++ b/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb
@@ -142,14 +142,15 @@ module Technoweenie # :nodoc:

     # The pseudo hierarchy containing the file relative to the container name
     # Example: <tt>:table_name/:id</tt>
  •    def base_path
    
  •      File.join(attachment_options[:path_prefix], attachment_path_id)
    
  •    def base_path(thumbnail = nil)
    
  •      file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix]
    
  •      File.join(file_system_path, attachment_path_id)
     end
    
     # The full path to the file relative to the container name
     # Example: <tt>:table_name/:id/:filename</tt>
     def full_filename(thumbnail = nil)
    
  •      File.join(base_path, thumbnail_name_for(thumbnail))
    
  •      File.join(base_path(thumbnail), thumbnail_name_for(thumbnail))
     end
    
     # All public objects are accessible via a GET request to the Cloud Files servers. You can generate a
    

    diff --git a/lib/technoweenie/attachment_fu/backends/s3_backend.rb b/lib/technoweenie/attachment_fu/backends/s3_backend.rb
    index 53b0caf..1593fc6 100644
    --- a/lib/technoweenie/attachment_fu/backends/s3_backend.rb
    +++ b/lib/technoweenie/attachment_fu/backends/s3_backend.rb
    @@ -252,14 +252,15 @@ module Technoweenie # :nodoc:

     # The pseudo hierarchy containing the file relative to the bucket name
     # Example: <tt>:table_name/:id</tt>
    
  •    def base_path
    
  •      File.join(attachment_options[:path_prefix], attachment_path_id)
    
  •    def base_path(thumbnail = nil)
    
  •      file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix]
    
  •      File.join(file_system_path, attachment_path_id)
     end
    
     # The full path to the file relative to the bucket name
     # Example: <tt>:table_name/:id/:filename</tt>
     def full_filename(thumbnail = nil)
    
  •      File.join(base_path, thumbnail_name_for(thumbnail))
    
  •      File.join(base_path(thumbnail), thumbnail_name_for(thumbnail))
     end
    
     # All public objects are accessible via a GET request to the S3 servers. You can generate a
    

    1.7.2

attachement_fu and rails 3.0

When I use my old proven attachement_fu setup from rails 2.x projects in a new rails 3.0 project I run into a problem with this line:

@image = @owner.images.create!(:uploaded_data => @DaTa)

The error is "unknown attribute: uploaded_data"

Word 2010 view

When a user uploads a Word 2010 doc (.docx) file, and then that file is accessed via the browser, the view on the page is garbled. You can download the link and then bring up the file and it appears correct. If you change the name of the file to .doc, you can view it on the browser. What's the solution to be able to view .docx on the browser?

In my production machine thumbnils arte not getting created

Am using attachement_fu, image-magick, r-magick for photo processing.

In my development machine all getting worked correctly.

But in my production machine the thumbnails were not created but the photo object was saved.

When i put the log in the attachemnt_fu plugin(attachment_fu.rb) in after_process_attachment method

the respond_to?(:process_attachment_with_processing) is coming as false

I don't know why. For Further debug i put the log in rmagick_processor.rb in process_attachment_with_processing but its not getting called too.

Please help me out from this problem.

I have changed the production machine last month from that only thumbnails not getting created. Before changing the production machine thumbnails were created correctly.

will i want to reinstall the image-magick and r-magick or give some fix please.

Cloudfile cdn down cause passenger completely to freeze

Hi there,

Today 19 Aug 2010 cloudfiles CDN had a problem.
When i deployed a project that uses attachment_fu with :storeage=>:cloudfiles it pulled down my complete passenger setup.
Not sure what caused this except that moving storage back to filesystem solved the imminent problem.

Will update once i have had time to figure out what exactly is causing this.

Core Image Processor causes segmentation faults on OS X 10.6.x - 64bit.

Using core_image on 10.6.x 32bit dev machines works fine. Moving it to the production Xserve causes a segmentation fault related to core imaging...I'm guessing an API difference between 32bit and 64bit?

I was able to solve the problem by changing the default Processor from core_image to mini_magick.

Error Log:

[Mon Oct 04 17:07:34 2010] [notice] mod_pushdaemon: Starting handler 'pushd', max_conns= 1, pid=3305
[Mon Oct 04 17:07:35 2010] [notice] mod_pushdaemon: Sending Heartbeat to 9788408:unknown (16 bytes).
/System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/objc/oc_wrapper.rb:50: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

[Mon Oct 04 17:07:53 2010] [error] [client 192.168.20.138] Premature end of script headers: admin, referer: http://panoptes1.private/admin/fibre_lines/1/section_calibrate
[ pid=3250 file=ext/apache2/Hooks.cpp:706 time=2010-10-04 17:07:53.361 ]:
The backend application (process 3281) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.
[Mon Oct 04 17:07:53 2010] [error] [client 192.168.20.138] mod_auth_digest_apple: Unable to authenticate for URI "/error/HTTP_INTERNAL_SERVER_ERROR.html.var" which fails to match original request URI "/admin/fibre_lines/1/section_image" from user "fotechadmin" for realm "Panoptes1" at location "/Local/Default" from the directory (error = -14090)., referer: http://panoptes1.private/admin/fibre_lines/1/section_calibrate
[Mon Oct 04 17:08:05 2010] [notice] mod_pushdaemon: Sending Heartbeat to 9788408:unknown (16 bytes).

Rails 3

When attachment_fu will be compatible with Rails 3?

attachment_fu + factory_girl

Seems like this should be working, unfortunately I can't get it to stop telling me:
ActiveRecord::RecordInvalid: Validation failed: Content type is not included in the list

I'm thinking this is because it depends on the content-type of the request header which isn't necessarily available when creating things in factories...

Some help would be greatly appreciated.

Thanks,
Steve

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.