attacheable 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README +66 -0
  3. data/Rakefile +1 -1
  4. metadata +5 -2
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Max Lapshin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,66 @@
1
+ attacheable
2
+ ===========
3
+
4
+ attacheable is a Rails/Merb plugin for working with attachments, mostly image attachments.
5
+
6
+ It is based on file_column, acts_as_attachment and attachment_fu plugins which have some shortcomings:
7
+
8
+ 1. Every single image thumbnail has its own record in the database.
9
+ 2. There is no method provided to regenerate thumbnails from an uploaded image.
10
+ 3. No chance to do on-the-fly thumbnail generation.
11
+ 4. Too many "engines" for working with images (attachment_fu) -- using ImageMagick command-like utilities is enough for most tasks (resizing and cropping of images); also, using command-line utilities instead of RMagick saves your memory.
12
+ 5. It is not simple to crop images.
13
+
14
+ Features
15
+ ========
16
+
17
+ attacheable is a fork of attachment_fu plugin by technoweenie (http://svn.techno-weenie.net/projects/plugins/attachment_fu/) with implementation of the following features:
18
+
19
+ 1. Disk-only file storage.
20
+ 2. All image-related work is done using command-line utilities: identify, convert, mogrify
21
+ 3. One image with *all* thumbnails maps to *one* record in the database.
22
+ 4. You can crop images.
23
+ 5. You can regenerate thumbnails any time you want.
24
+ 6. When deleting an image, the corresponding filesystem catalog for the record is deleted -- this deletes all thumbnails and all files that may be generated for this record by other plugins.
25
+
26
+ Plus, there is an experimental feature of copying file attachments over scp (useful when you have a Rails cluster).
27
+
28
+ Usage
29
+ =====
30
+
31
+ Create a migration:
32
+
33
+ create_table :images do |t|
34
+ t.string :filename
35
+ t.string :content_type
36
+ t.integer :width
37
+ t.integer :height
38
+ t.string :type
39
+ end
40
+
41
+ This goes to your ActiveRecord:
42
+
43
+ class Image < ActiveRecord::Base
44
+ has_attachment :thumbnails => {:medium => "120x", :large => "800x600", :preview => "100x100"},
45
+ :croppable_thumbnails => %w(preview)
46
+ validates_as_attachment
47
+ end
48
+
49
+ In your view (editing form):
50
+
51
+ Use uploaded_data field.
52
+
53
+ In your view (view a record):
54
+
55
+ <%= image_tag @image.public_filename(:preview) %>
56
+
57
+ You can use regenerate_thumbnails! method to regenerate all thumbnails for an image, like this:
58
+
59
+ Image.regenerate_thumbnails!(:preview)
60
+
61
+
62
+ Authors
63
+ =======
64
+
65
+ Max Lapshin <max@maxidoors.ru>, http://maxidoors.ru
66
+ Yaroslav Markin <yaroslav@markin.net>
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
 
6
6
  spec = Gem::Specification.new do |s|
7
7
  s.name = 'attacheable'
8
- s.version = '1.0'
8
+ s.version = '1.1'
9
9
  s.summary = 'Library to handle image uploads'
10
10
  s.autorequire = 'attacheable'
11
11
  s.author = "Max Lapshin"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attacheable
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.0"
4
+ version: "1.1"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Lapshin
@@ -9,7 +9,7 @@ autorequire: attacheable
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-04 00:00:00 +04:00
12
+ date: 2008-04-05 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,7 +24,10 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - init.rb
26
26
  - lib
27
+ - MIT-LICENSE
28
+ - pkg
27
29
  - Rakefile
30
+ - README
28
31
  - README.ru
29
32
  - test
30
33
  has_rdoc: false