miniatura 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb561f6a1632fa722779a57e015b2423307130c6
4
- data.tar.gz: '059b6c4dc90317b0de7228e1e1f7a69d4db786fc'
3
+ metadata.gz: 9bed6e585409597e079a105daa13b224f7e1cacb
4
+ data.tar.gz: 75b332904b468e68a5e100d1434be3e597257b14
5
5
  SHA512:
6
- metadata.gz: 1f65e471cb1f5aed0658b689e1d3419ab5d2a0fe88495ff3fb571a54f8ee2aec12a6b9aa1bf0ee08e85b6e4e53b6f51157cf8a22e25cc905f783afbc10e890f6
7
- data.tar.gz: b4271e5e466b6c9d352079b36da0b81fef41561e252ce7d2f8a748b57ebd727124b3b1b791b8130b501edc2fe91a4b368b4e1e31944cf91f4753911501be0b10
6
+ metadata.gz: a380154a55cd274d87fdc89292e19e654c23cf5085886efe13460db3e32a74c425e9d6ed605d920905e40086eb6cf3b9bde3c4b34157598c75861fedb20998c2
7
+ data.tar.gz: f00f3ce2943c3e30b3e043804e57d686c2932d80cece7da2d132563467995e1bd3e61ab9fcb4cb7cfa12288f1e68e8a92e053631c52f096ecf8e780fe04ca886
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- # source 'https://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in miniatura.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,9 +1,5 @@
1
1
  # Miniatura
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/miniatura`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
3
  ## Installation
8
4
 
9
5
  Add this line to your application's Gemfile:
@@ -20,9 +16,47 @@ Or install it yourself as:
20
16
 
21
17
  $ gem install miniatura
22
18
 
23
- ## Usage
19
+ # Usage
20
+
21
+ In the Rails app/uploaders/filename.rb, call the generate_thumb function with options.
22
+ The options are passed as hash to this function, can be also empty.
23
+
24
+ The options are:
25
+
26
+ * size - The height x width of the thumbnail to be generated, by default will take the same size of that of the video, type is string.
27
+ * file_extension - Format of the file to be saved, by default the format at will be "jpeg", type is string.
28
+ * quality - Quality of the file to be saved, type is integer.
29
+ * time_frame - The time in the video at which the thumbnail must be generated, type is string.
30
+
24
31
 
25
- TODO: Write usage instructions here
32
+ ## Examples
33
+
34
+ Here's a working example:
35
+
36
+ In your Rails app/uploaders/video_uploader.rb:
37
+
38
+ ```ruby
39
+ class VideoUploader < CarrierWave::Uploader::Base
40
+ include CarrierWave::RMagick
41
+ include Miniatura
42
+ storage :file
43
+
44
+ version :thumb do
45
+ process generate_thumb:[{:size => "200x200",:quality => 5, :time_frame => "00:0:04", :file_extension => "jpeg"}]
46
+ def full_filename for_file
47
+ png_name for_file, version_name, "jpeg"
48
+ end
49
+ end
50
+
51
+ def png_name for_file, version_name, format
52
+ %Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.#{format}}
53
+ end
54
+
55
+ def store_dir
56
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
57
+ end
58
+ end
59
+ ```
26
60
 
27
61
  ## Development
28
62
 
@@ -1,3 +1,3 @@
1
1
  module Miniatura
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/miniatura.rb CHANGED
@@ -3,28 +3,12 @@ require "miniatura/version"
3
3
  require "miniatura/options"
4
4
  require "miniatura/logger"
5
5
  require "miniatura/generate_command"
6
- require 'mini_exiftool'
7
6
 
8
7
  module Miniatura
9
8
  def generate_thumb options = {}
10
9
  options[:file_extension] ||= 'jpeg'
11
10
  options[:logger] = Rails.logger
12
11
  options[:rotate] = 0
13
- # options[:rotate]
14
- # p video = MiniExiftool.new(current_path)
15
- # p "before"
16
- # p options
17
- # p orientation = video.rotation
18
- # case orientation
19
- # when 0
20
- # options[:rotate] = 0
21
- # when 90
22
- # options[:rotate] = 0
23
- # when 180
24
- # options[:rotate] = 180
25
- # end
26
- # p "after"
27
- p options
28
12
  tmp_path = File.join( File.dirname(current_path), "tmpfile.#{options[:file_extension]}")
29
13
  thumbnail = GenerateCommand.new(current_path, tmp_path)
30
14
  cmd = thumbnail.generate_command(options)
data/miniatura.gemspec CHANGED
@@ -2,9 +2,6 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'miniatura/version'
5
- # require "miniatura/options"
6
- # require "miniatura/logger"
7
- # require "miniatura/generate_command"
8
5
 
9
6
  Gem::Specification.new do |spec|
10
7
  spec.name = "miniatura"
@@ -13,8 +10,7 @@ Gem::Specification.new do |spec|
13
10
  spec.email = ["ssooraj7@gmail.com"]
14
11
 
15
12
  spec.summary = "Carrierwave Video Thumbnailer."
16
- spec.description = "Generates a thumbnail carrierwave uploaded videos."
17
- # spec.homepage = "TODO: Put your gem's website or public repo URL here."
13
+ spec.description = "Generates a thumbnail for carrierwave uploaded videos."
18
14
  spec.license = "MIT"
19
15
 
20
16
  spec.files = `git ls-files`.split("\n")
@@ -26,5 +22,4 @@ Gem::Specification.new do |spec|
26
22
  spec.add_development_dependency "rake", "~> 10.0"
27
23
  spec.add_development_dependency "rspec", "~> 3.0"
28
24
  spec.add_development_dependency "carrierwave-video", "~> 0.5.6"
29
- spec.add_development_dependency "mini_exiftool", "~> 2.7", ">= 2.7.6"
30
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miniatura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ssooraj
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-05 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,27 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.5.6
69
- - !ruby/object:Gem::Dependency
70
- name: mini_exiftool
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.7'
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 2.7.6
79
- type: :development
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - "~>"
84
- - !ruby/object:Gem::Version
85
- version: '2.7'
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: 2.7.6
89
- description: Generates a thumbnail carrierwave uploaded videos.
69
+ description: Generates a thumbnail for carrierwave uploaded videos.
90
70
  email:
91
71
  - ssooraj7@gmail.com
92
72
  executables: []