carrierwave-picture 0.2.2 → 0.3.3
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de00efe56dca1e604d1f956f38bf2de3a551dfdbb45d93f178d422db69dd693
|
4
|
+
data.tar.gz: a347cf52d04c1b983adbd520defe89e5fde646299d488e08f8ed0453e7301ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e19ad6a3ddba35da9e868305d4546983373fda6d1edc4b933e6dd0d7f7983560de10442e4457e497dbb66841c5daa37acbec8bc659cd28b51bb36905b0d3c013
|
7
|
+
data.tar.gz: 4fdc8105aaaab2928b3fd281fc744b1afc6de3bafb823f119e6ac8b00462bb1596cef03a8924e1ca1b5572b7ae317b4bcb727d14487ef83c62895a4d2147b75c
|
data/README.md
CHANGED
@@ -60,6 +60,14 @@ It is return html code like:
|
|
60
60
|
</picture>
|
61
61
|
```
|
62
62
|
|
63
|
+
If you have uploaded images you can use rake task to convert. Default path is "public":
|
64
|
+
|
65
|
+
$ rake picture:prepare[:path]
|
66
|
+
|
67
|
+
Example:
|
68
|
+
|
69
|
+
$ rake picture:prepare["public/uploads"]
|
70
|
+
|
63
71
|
## Contributing
|
64
72
|
|
65
73
|
1. Fork it
|
@@ -1,6 +1,12 @@
|
|
1
1
|
module PictureConverter
|
2
2
|
def self.convert(current_path)
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
unless File.exist?("#{current_path}.webp")
|
5
|
+
system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.webp"
|
6
|
+
end
|
7
|
+
unless File.exist?("#{current_path}.jp2")
|
8
|
+
system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.jp2"
|
9
|
+
end
|
10
|
+
|
5
11
|
end
|
6
12
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :picture do
|
2
|
+
desc "Picture task converting uploaded images to webp and jp2 formats"
|
3
|
+
|
4
|
+
task :prepare, [:path] do |task, args|
|
5
|
+
p "This may take some time..."
|
6
|
+
|
7
|
+
path = args[:path] || 'public'
|
8
|
+
|
9
|
+
["png", "jpg", "jpeg", "gif"].each do |dim|
|
10
|
+
|
11
|
+
Dir[ path + "/**/*.{#{dim}}" ].each do |file|
|
12
|
+
p "#{file} converting"
|
13
|
+
|
14
|
+
begin
|
15
|
+
PictureConverter.convert(file)
|
16
|
+
rescue => e
|
17
|
+
p e
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-picture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Pavlov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/carrierwave-picture/picture_helper.rb
|
96
96
|
- lib/carrierwave-picture/railtie.rb
|
97
97
|
- lib/carrierwave-picture/version.rb
|
98
|
+
- lib/tasks/picture.rake
|
98
99
|
homepage: https://github.com/PavlovIgor/carrierwave-picture
|
99
100
|
licenses:
|
100
101
|
- MIT
|