public
Description: Rails plugin for uploading images as resources, with support for resizing, text stamping, and other special effects.
Homepage: http://fleximage.rubyforge.org
Clone URL: git://github.com/Squeegy/fleximage.git
Search Repo:
Added preprocess_image test and temp image for form redisplay tests
Squeegy (author)
Sat Apr 19 15:09:47 -0700 2008
commit  137683d64d25c9b842ce95b4a5d842165e585810
tree    6c156b7f559df78a047207d6e738555119f1af2e
parent  9c53eb492d3cb333a089aa523b08e29c82836dfc
...
1
2
 
...
1
 
2
0
@@ -1,3 +1,3 @@
0
 *.log
0
-test/rails_root/public/uploads/
0
+test/rails_root/public/uploads/*
...
1
 
 
2
...
1
2
3
4
0
@@ -1,3 +1,5 @@
0
 class Avatar < ActiveRecord::Base
0
+ acts_as_fleximage :image_directory => 'public/uploads'
0
+ validates_presence_of :username
0
 end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -1 +1,22 @@
0
+require 'test/test_helper'
0
+
0
+class FleximagePreprocessImageOptionTest < Test::Unit::TestCase
0
+ def test_should_resize_image_on_upload
0
+ PhotoDb.preprocess_image do |image|
0
+ image.resize '50x50', :crop => true
0
+ end
0
+
0
+ p = PhotoDb.new(:image_file => files(:photo))
0
+ assert p.save, 'Record expected to be allowed to save'
0
+
0
+ assert_equal 50, p.load_image.columns
0
+ assert_equal 50, p.load_image.rows
0
+
0
+ assert_equal 50, p.image_height
0
+ assert_equal 50, p.image_width
0
+
0
+ ensure
0
+ PhotoDb.preprocess_image_operation = nil
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
@@ -1 +1,16 @@
0
+require 'test/test_helper'
0
+
0
+class FleximageTempImageTest < Test::Unit::TestCase
0
+ def test_should_save_and_use_a_temp_image
0
+ a1 = Avatar.new(:image_file => files(:photo))
0
+ assert ! a1.save
0
+ assert_equal 'photo.jpg', a1.image_file_temp
0
+ assert File.exists?("#{RAILS_ROOT}/tmp/fleximage/#{a1.image_file_temp}")
0
+
0
+ a2 = Avatar.new(:username => 'Alex Wayne', :image_file_temp => 'photo.jpg')
0
+ assert a2.save
0
+ assert File.exists?(a2.file_path)
0
+ assert ! File.exists?("#{RAILS_ROOT}/tmp/fleximage/#{a2.image_file_temp}")
0
+ end
0
+end

Comments

    No one has commented yet.