0239e56b370ced1034360721e8f9a67c17a93ad4
[selectricity] / vendor / plugins / attachment_fu / init.rb
1 require 'tempfile'
2
3 Tempfile.class_eval do
4   # overwrite so tempfiles use the extension of the basename.  important for rmagick and image science
5   def make_tmpname(basename, n)
6     ext = nil
7     sprintf("%s%d-%d%s", basename.to_s.gsub(/\.\w+$/) { |s| ext = s; '' }, $$, n, ext)
8   end
9 end
10
11 require 'geometry'
12 ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
13 Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
14 FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path

Benjamin Mako Hill || Want to submit a patch?