lib/fleximage/model.rb
# Load the default image, or raise an expection
Load the default image, or raise an expection
Load the default image or raise an expection
def master_image_not_found
          if self.class.default_image_path
            @output_image = Magick::Image.read("#{RAILS_ROOT}/#{self.class.default_image_path}").first
          elsif self.class.default_image
            x, y = Fleximage::Operator::Base.size_to_xy(self.class.default_image[:size])
            color = self.class.default_image[:color]
            @output_image = Magick::Image.new(x, y) do
              self.background_color = color if color && color != :transparent
            end
          else
            message = "Master image was not found for this record"
            if !self.class.db_store?
              message << "\nExpected image to be at:"
              message << "\n  #{file_path}"
            end
            raise MasterImageNotFound, message
          end
        ensure
          GC.start
        end
def master_image_not_found if self . class . default_image_path @output_image = Magick :: Image . read ( "#{RAILS_ROOT}/#{self.class.default_image_path}" ) . first elsif self . class . default_image x , y = Fleximage :: Operator :: Base . size_to_xy ( self . class . default_image [ :size ] ) color = self . class . default_image [ :color ] @output_image = Magick :: Image . new ( x , y ) do self . background_color = color if color && color != :transparent end else message = "Master image was not found for this record" if ! self . class . db_store? message << "\nExpected image to be at:" message << "\n  #{file_path}" end raise MasterImageNotFound , message end ensure GC . start end
Load the default image, or raise an expection
Load the default image or raise an expection
# Load the default image from a path # Or create a default image # No default, not master image, so raise exception