carrierwave-picture 0.1.0 → 0.2.0
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: 592b6f4fc1639d3636d45d361ab998f1605394a1ae66babd4e0817e3af6cff06
|
4
|
+
data.tar.gz: c6e1bb1f4e0e44fad92930a25de0f34a2ab876fd705c2e4f1548b1f73f8da489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78a94da435f4aaea0dc4688710efc182f2b50cb79e042f644a905ea31e2b2174a4e83d9b672b6c6c65e80bc954203fcb297dc8aeb3e29b00580021989e374849
|
7
|
+
data.tar.gz: 5aa3058482647c18728d500b8300dcc4e77f8ceab1789cbaa08382afb8f69f5f08e844600ba8cbbcf5f0cbc14583df3149c46562c5297dde64b5ed29e72c7ca6
|
data/README.md
CHANGED
@@ -1,24 +1,18 @@
|
|
1
1
|
# Carrierwave::Picture
|
2
2
|
|
3
|
-
Simple gem for converting images to webp and
|
3
|
+
Simple gem for converting images to webp and jp2 via imagemagic and add picture_tag to action view.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
$ convert -version
|
10
|
-
|
11
|
-
If not, type in your OSX console:
|
7
|
+
Install dependencies OSX:
|
12
8
|
|
13
9
|
$ brew install imagemagick
|
10
|
+
$ brew install webp
|
14
11
|
|
15
12
|
Or in your Debian, Ubuntu console:
|
16
13
|
|
17
|
-
apt-get
|
18
|
-
|
19
|
-
Or in your CentOS, Fedora console:
|
20
|
-
|
21
|
-
yum -y install ImageMagick
|
14
|
+
sudo apt-get install imagemagick
|
15
|
+
sudo apt-get install webp
|
22
16
|
|
23
17
|
After ImageMagic installed add this line to your application's Gemfile:
|
24
18
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module PictureConverter
|
2
2
|
def self.convert(current_path)
|
3
3
|
system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.webp" unless File.extname(current_path) == "webp"
|
4
|
-
system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.
|
4
|
+
system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.jp2" unless File.extname(current_path) == "jp2"
|
5
5
|
end
|
6
6
|
end
|
@@ -9,9 +9,9 @@ module PictureHelper
|
|
9
9
|
style: "height: inherit; width: inherit" if File.exist?(Rails.root.join("public/#{path}.webp"))
|
10
10
|
concat content_tag :source,
|
11
11
|
nil,
|
12
|
-
srcset: "#{path}.
|
13
|
-
type: "image/
|
14
|
-
style: "height: inherit; width: inherit" if File.exist?(Rails.root.join("public/#{path}.
|
12
|
+
srcset: "#{path}.jp2",
|
13
|
+
type: "image/jp2",
|
14
|
+
style: "height: inherit; width: inherit" if File.exist?(Rails.root.join("public/#{path}.jp2"))
|
15
15
|
concat image_tag path, style: "height: inherit; width: inherit"
|
16
16
|
end
|
17
17
|
|