picturama 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/config/config.sample.yml +3 -1
- data/lib/picturama/version.rb +1 -1
- data/lib/tasks/resized.rake +27 -0
- data/lib/tasks/thumbnail.rake +2 -0
- data/lib/tasks/url.rake +2 -0
- metadata +4 -3
data/Gemfile.lock
CHANGED
data/config/config.sample.yml
CHANGED
data/lib/picturama/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'mini_magick'
|
2
|
+
|
3
|
+
namespace :resized do
|
4
|
+
|
5
|
+
desc "Generate resized pictures for a given folder or just a single file"
|
6
|
+
task :generate, :source do |t, args|
|
7
|
+
if File.directory?(args[:source]) || File.exists?(args[:source])
|
8
|
+
size = Picturama::config['resized_default_size']
|
9
|
+
album = Picturama::Album.new(:folder => args[:source])
|
10
|
+
puts "Generating #{album.count_pictures} resized for folder #{args[:source]}..."
|
11
|
+
puts "Size: #{size}"
|
12
|
+
album.init_resized
|
13
|
+
album.pictures.each do |picture|
|
14
|
+
unless picture.has_resized?
|
15
|
+
pic = MiniMagick::Image.open(picture.path)
|
16
|
+
pic.resize "#{size}"
|
17
|
+
pic.format "jpg"
|
18
|
+
pic.write picture.resized
|
19
|
+
puts "Resized picture generated for source #{File.basename(picture.path)}. Target destination #{File.basename(picture.resized)}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
puts "Error => target destination #{args[:source]} does not exist"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/tasks/thumbnail.rake
CHANGED
data/lib/tasks/url.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picturama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/picturama/picture.rb
|
82
82
|
- lib/picturama/version.rb
|
83
83
|
- lib/tasks/album.rake
|
84
|
+
- lib/tasks/resized.rake
|
84
85
|
- lib/tasks/thumbnail.rake
|
85
86
|
- lib/tasks/url.rake
|
86
87
|
- picturama.gemspec
|
@@ -107,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
108
|
version: '0'
|
108
109
|
segments:
|
109
110
|
- 0
|
110
|
-
hash: -
|
111
|
+
hash: -997975699
|
111
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
113
|
none: false
|
113
114
|
requirements:
|
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
version: '0'
|
117
118
|
segments:
|
118
119
|
- 0
|
119
|
-
hash: -
|
120
|
+
hash: -997975699
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
123
|
rubygems_version: 1.8.24
|