robinboening-fleximage 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +14 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +257 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/autotest.rb +5 -0
- data/fleximage.gemspec +179 -0
- data/init.rb +1 -0
- data/lib/dsl_accessor.rb +52 -0
- data/lib/fleximage.rb +56 -0
- data/lib/fleximage/aviary_controller.rb +75 -0
- data/lib/fleximage/blank.rb +70 -0
- data/lib/fleximage/helper.rb +41 -0
- data/lib/fleximage/image_proxy.rb +69 -0
- data/lib/fleximage/legacy_view.rb +63 -0
- data/lib/fleximage/model.rb +711 -0
- data/lib/fleximage/operator/background.rb +62 -0
- data/lib/fleximage/operator/base.rb +189 -0
- data/lib/fleximage/operator/border.rb +50 -0
- data/lib/fleximage/operator/crop.rb +58 -0
- data/lib/fleximage/operator/image_overlay.rb +85 -0
- data/lib/fleximage/operator/resize.rb +92 -0
- data/lib/fleximage/operator/shadow.rb +87 -0
- data/lib/fleximage/operator/text.rb +104 -0
- data/lib/fleximage/operator/trim.rb +14 -0
- data/lib/fleximage/operator/unsharp_mask.rb +36 -0
- data/lib/fleximage/rmagick_image_patch.rb +5 -0
- data/lib/fleximage/view.rb +57 -0
- data/tasks/fleximage_tasks.rake +154 -0
- data/test/fixtures/100x1.jpg +0 -0
- data/test/fixtures/100x100.jpg +0 -0
- data/test/fixtures/1x1.jpg +0 -0
- data/test/fixtures/1x100.jpg +0 -0
- data/test/fixtures/cmyk.jpg +0 -0
- data/test/fixtures/not_a_photo.xml +1 -0
- data/test/fixtures/photo.jpg +0 -0
- data/test/mock_file.rb +21 -0
- data/test/rails_root/app/controllers/application.rb +10 -0
- data/test/rails_root/app/controllers/avatars_controller.rb +85 -0
- data/test/rails_root/app/controllers/photo_bares_controller.rb +85 -0
- data/test/rails_root/app/controllers/photo_dbs_controller.rb +85 -0
- data/test/rails_root/app/controllers/photo_files_controller.rb +85 -0
- data/test/rails_root/app/helpers/application_helper.rb +3 -0
- data/test/rails_root/app/helpers/avatars_helper.rb +2 -0
- data/test/rails_root/app/helpers/photo_bares_helper.rb +2 -0
- data/test/rails_root/app/helpers/photo_dbs_helper.rb +2 -0
- data/test/rails_root/app/helpers/photo_files_helper.rb +2 -0
- data/test/rails_root/app/locales/de.yml +7 -0
- data/test/rails_root/app/locales/en.yml +8 -0
- data/test/rails_root/app/models/abstract.rb +8 -0
- data/test/rails_root/app/models/avatar.rb +4 -0
- data/test/rails_root/app/models/photo_bare.rb +7 -0
- data/test/rails_root/app/models/photo_custom_error.rb +10 -0
- data/test/rails_root/app/models/photo_db.rb +3 -0
- data/test/rails_root/app/models/photo_file.rb +3 -0
- data/test/rails_root/app/models/photo_s3.rb +5 -0
- data/test/rails_root/app/views/avatars/edit.html.erb +17 -0
- data/test/rails_root/app/views/avatars/index.html.erb +20 -0
- data/test/rails_root/app/views/avatars/new.html.erb +16 -0
- data/test/rails_root/app/views/avatars/show.html.erb +8 -0
- data/test/rails_root/app/views/layouts/avatars.html.erb +17 -0
- data/test/rails_root/app/views/layouts/photo_bares.html.erb +17 -0
- data/test/rails_root/app/views/layouts/photo_dbs.html.erb +17 -0
- data/test/rails_root/app/views/layouts/photo_files.html.erb +17 -0
- data/test/rails_root/app/views/photo_bares/edit.html.erb +12 -0
- data/test/rails_root/app/views/photo_bares/index.html.erb +18 -0
- data/test/rails_root/app/views/photo_bares/new.html.erb +11 -0
- data/test/rails_root/app/views/photo_bares/show.html.erb +3 -0
- data/test/rails_root/app/views/photo_dbs/edit.html.erb +32 -0
- data/test/rails_root/app/views/photo_dbs/index.html.erb +26 -0
- data/test/rails_root/app/views/photo_dbs/new.html.erb +31 -0
- data/test/rails_root/app/views/photo_dbs/show.html.erb +23 -0
- data/test/rails_root/app/views/photo_files/edit.html.erb +27 -0
- data/test/rails_root/app/views/photo_files/index.html.erb +24 -0
- data/test/rails_root/app/views/photo_files/new.html.erb +26 -0
- data/test/rails_root/app/views/photo_files/show.html.erb +18 -0
- data/test/rails_root/config/boot.rb +109 -0
- data/test/rails_root/config/database.yml +7 -0
- data/test/rails_root/config/environment.rb +66 -0
- data/test/rails_root/config/environments/development.rb +18 -0
- data/test/rails_root/config/environments/production.rb +19 -0
- data/test/rails_root/config/environments/sqlite3.rb +0 -0
- data/test/rails_root/config/environments/test.rb +22 -0
- data/test/rails_root/config/initializers/inflections.rb +10 -0
- data/test/rails_root/config/initializers/load_translations.rb +4 -0
- data/test/rails_root/config/initializers/mime_types.rb +5 -0
- data/test/rails_root/config/routes.rb +43 -0
- data/test/rails_root/db/migrate/001_create_photo_files.rb +16 -0
- data/test/rails_root/db/migrate/002_create_photo_dbs.rb +16 -0
- data/test/rails_root/db/migrate/003_create_photo_bares.rb +12 -0
- data/test/rails_root/db/migrate/004_create_avatars.rb +13 -0
- data/test/rails_root/db/migrate/005_create_photo_s3s.rb +12 -0
- data/test/rails_root/public/.htaccess +40 -0
- data/test/rails_root/public/404.html +30 -0
- data/test/rails_root/public/422.html +30 -0
- data/test/rails_root/public/500.html +30 -0
- data/test/rails_root/public/dispatch.cgi +10 -0
- data/test/rails_root/public/dispatch.fcgi +24 -0
- data/test/rails_root/public/dispatch.rb +10 -0
- data/test/rails_root/public/favicon.ico +0 -0
- data/test/rails_root/public/images/rails.png +0 -0
- data/test/rails_root/public/index.html +277 -0
- data/test/rails_root/public/javascripts/application.js +2 -0
- data/test/rails_root/public/javascripts/controls.js +963 -0
- data/test/rails_root/public/javascripts/dragdrop.js +972 -0
- data/test/rails_root/public/javascripts/effects.js +1120 -0
- data/test/rails_root/public/javascripts/prototype.js +4225 -0
- data/test/rails_root/public/robots.txt +5 -0
- data/test/rails_root/public/stylesheets/scaffold.css +74 -0
- data/test/rails_root/vendor/plugins/fleximage/init.rb +2 -0
- data/test/s3_stubs.rb +7 -0
- data/test/test_helper.rb +82 -0
- data/test/unit/abstract_test.rb +20 -0
- data/test/unit/basic_model_test.rb +40 -0
- data/test/unit/blank_test.rb +23 -0
- data/test/unit/default_image_path_option_test.rb +16 -0
- data/test/unit/dsl_accessor_test.rb +120 -0
- data/test/unit/file_upload_from_local_test.rb +31 -0
- data/test/unit/file_upload_from_strings_test.rb +23 -0
- data/test/unit/file_upload_from_url_test.rb +35 -0
- data/test/unit/file_upload_to_db_test.rb +41 -0
- data/test/unit/has_store_test.rb +4 -0
- data/test/unit/i18n_messages_test.rb +49 -0
- data/test/unit/image_directory_option_test.rb +20 -0
- data/test/unit/image_proxy_test.rb +17 -0
- data/test/unit/image_storage_format_option_test.rb +31 -0
- data/test/unit/magic_columns_test.rb +34 -0
- data/test/unit/minimum_image_size_test.rb +56 -0
- data/test/unit/operator_base_test.rb +124 -0
- data/test/unit/operator_resize_test.rb +18 -0
- data/test/unit/preprocess_image_option_test.rb +21 -0
- data/test/unit/require_image_option_test.rb +30 -0
- data/test/unit/temp_image_test.rb +23 -0
- data/test/unit/use_creation_date_based_directories_option_test.rb +16 -0
- metadata +258 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
class PhotoCustomError < ActiveRecord::Base
|
2
|
+
set_table_name :photo_dbs
|
3
|
+
acts_as_fleximage do
|
4
|
+
image_directory 'public/uploads'
|
5
|
+
validates_image_size '2x2'
|
6
|
+
missing_image_message "needs to be attached"
|
7
|
+
invalid_image_message "seems to be broken"
|
8
|
+
image_too_small_message "must be bigger (min. size: {{minimum}})"
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1>Editing avatar</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :avatar %>
|
4
|
+
|
5
|
+
<% form_for(@avatar) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Username</b><br />
|
8
|
+
<%= f.text_field :username %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.submit "Update" %>
|
13
|
+
</p>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= link_to 'Show', @avatar %> |
|
17
|
+
<%= link_to 'Back', avatars_path %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1>Listing avatars</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Username</th>
|
6
|
+
</tr>
|
7
|
+
|
8
|
+
<% for avatar in @avatars %>
|
9
|
+
<tr>
|
10
|
+
<td><%=h avatar.username %></td>
|
11
|
+
<td><%= link_to 'Show', avatar %></td>
|
12
|
+
<td><%= link_to 'Edit', edit_avatar_path(avatar) %></td>
|
13
|
+
<td><%= link_to 'Destroy', avatar, :confirm => 'Are you sure?', :method => :delete %></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
<br />
|
19
|
+
|
20
|
+
<%= link_to 'New avatar', new_avatar_path %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h1>New avatar</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :avatar %>
|
4
|
+
|
5
|
+
<% form_for(@avatar) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Username</b><br />
|
8
|
+
<%= f.text_field :username %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.submit "Create" %>
|
13
|
+
</p>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= link_to 'Back', avatars_path %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>Avatars: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>PhotoBares: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>PhotoDbs: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>PhotoFiles: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<h1>Listing photo_bares</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
</tr>
|
6
|
+
|
7
|
+
<% for photo_bare in @photo_bares %>
|
8
|
+
<tr>
|
9
|
+
<td><%= link_to 'Show', photo_bare %></td>
|
10
|
+
<td><%= link_to 'Edit', edit_photo_bare_path(photo_bare) %></td>
|
11
|
+
<td><%= link_to 'Destroy', photo_bare, :confirm => 'Are you sure?', :method => :delete %></td>
|
12
|
+
</tr>
|
13
|
+
<% end %>
|
14
|
+
</table>
|
15
|
+
|
16
|
+
<br />
|
17
|
+
|
18
|
+
<%= link_to 'New photo_bare', new_photo_bare_path %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1>Editing photo_db</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :photo_db %>
|
4
|
+
|
5
|
+
<% form_for(@photo_db) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Image filename</b><br />
|
8
|
+
<%= f.text_field :image_filename %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Image width</b><br />
|
13
|
+
<%= f.text_field :image_width %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Image height</b><br />
|
18
|
+
<%= f.text_field :image_height %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<b>Image file data</b><br />
|
23
|
+
<%= f.text_field :image_file_data %>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p>
|
27
|
+
<%= f.submit "Update" %>
|
28
|
+
</p>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= link_to 'Show', @photo_db %> |
|
32
|
+
<%= link_to 'Back', photo_dbs_path %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h1>Listing photo_dbs</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Image filename</th>
|
6
|
+
<th>Image width</th>
|
7
|
+
<th>Image height</th>
|
8
|
+
<th>Image file data</th>
|
9
|
+
</tr>
|
10
|
+
|
11
|
+
<% for photo_db in @photo_dbs %>
|
12
|
+
<tr>
|
13
|
+
<td><%=h photo_db.image_filename %></td>
|
14
|
+
<td><%=h photo_db.image_width %></td>
|
15
|
+
<td><%=h photo_db.image_height %></td>
|
16
|
+
<td><%=h photo_db.image_file_data %></td>
|
17
|
+
<td><%= link_to 'Show', photo_db %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_photo_db_path(photo_db) %></td>
|
19
|
+
<td><%= link_to 'Destroy', photo_db, :confirm => 'Are you sure?', :method => :delete %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</table>
|
23
|
+
|
24
|
+
<br />
|
25
|
+
|
26
|
+
<%= link_to 'New photo_db', new_photo_db_path %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<h1>New photo_db</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :photo_db %>
|
4
|
+
|
5
|
+
<% form_for(@photo_db) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Image filename</b><br />
|
8
|
+
<%= f.text_field :image_filename %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Image width</b><br />
|
13
|
+
<%= f.text_field :image_width %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Image height</b><br />
|
18
|
+
<%= f.text_field :image_height %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<b>Image file data</b><br />
|
23
|
+
<%= f.text_field :image_file_data %>
|
24
|
+
</p>
|
25
|
+
|
26
|
+
<p>
|
27
|
+
<%= f.submit "Create" %>
|
28
|
+
</p>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= link_to 'Back', photo_dbs_path %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<p>
|
2
|
+
<b>Image filename:</b>
|
3
|
+
<%=h @photo_db.image_filename %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<b>Image width:</b>
|
8
|
+
<%=h @photo_db.image_width %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Image height:</b>
|
13
|
+
<%=h @photo_db.image_height %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Image file data:</b>
|
18
|
+
<%=h @photo_db.image_file_data %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
|
22
|
+
<%= link_to 'Edit', edit_photo_db_path(@photo_db) %> |
|
23
|
+
<%= link_to 'Back', photo_dbs_path %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h1>Editing photo_file</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :photo_file %>
|
4
|
+
|
5
|
+
<% form_for(@photo_file) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Image filename</b><br />
|
8
|
+
<%= f.text_field :image_filename %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Image width</b><br />
|
13
|
+
<%= f.text_field :image_width %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Image height</b><br />
|
18
|
+
<%= f.text_field :image_height %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<%= f.submit "Update" %>
|
23
|
+
</p>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<%= link_to 'Show', @photo_file %> |
|
27
|
+
<%= link_to 'Back', photo_files_path %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Listing photo_files</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Image filename</th>
|
6
|
+
<th>Image width</th>
|
7
|
+
<th>Image height</th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% for photo_file in @photo_files %>
|
11
|
+
<tr>
|
12
|
+
<td><%=h photo_file.image_filename %></td>
|
13
|
+
<td><%=h photo_file.image_width %></td>
|
14
|
+
<td><%=h photo_file.image_height %></td>
|
15
|
+
<td><%= link_to 'Show', photo_file %></td>
|
16
|
+
<td><%= link_to 'Edit', edit_photo_file_path(photo_file) %></td>
|
17
|
+
<td><%= link_to 'Destroy', photo_file, :confirm => 'Are you sure?', :method => :delete %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<%= link_to 'New photo_file', new_photo_file_path %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<h1>New photo_file</h1>
|
2
|
+
|
3
|
+
<%= error_messages_for :photo_file %>
|
4
|
+
|
5
|
+
<% form_for(@photo_file) do |f| %>
|
6
|
+
<p>
|
7
|
+
<b>Image filename</b><br />
|
8
|
+
<%= f.text_field :image_filename %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Image width</b><br />
|
13
|
+
<%= f.text_field :image_width %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>Image height</b><br />
|
18
|
+
<%= f.text_field :image_height %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<p>
|
22
|
+
<%= f.submit "Create" %>
|
23
|
+
</p>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<%= link_to 'Back', photo_files_path %>
|