picturama 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- picturama (0.0.5)
4
+ picturama (0.0.6)
5
5
  mini_magick (~> 3.6.0)
6
6
  stringex (~> 2.0.2)
7
7
 
@@ -2,4 +2,6 @@ picturama:
2
2
  album_source: '[your_path_here]'
3
3
  allowed_formats: ['jpg','png','jpeg','JPG']
4
4
  thumbnail_prefix: thumb_
5
- thumnail_default_size: "200x200"
5
+ thumnail_default_size: "200x200"
6
+ resized_prefix: resized_
7
+ resized_default_size: "800x800"
@@ -1,3 +1,3 @@
1
1
  module Picturama
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -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
@@ -1,3 +1,5 @@
1
+ require 'mini_magick'
2
+
1
3
  namespace :thumbnail do
2
4
 
3
5
  desc "Generate thumbnail for a given folder or just a single file"
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  namespace :url do
2
4
  desc "Normalize album names name for URL format"
3
5
  task :sluglify, :source do |t, args|
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.5
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: -319223615
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: -319223615
120
+ hash: -997975699
120
121
  requirements: []
121
122
  rubyforge_project:
122
123
  rubygems_version: 1.8.24