workspace-media 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/workspace-media.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eb32e5564e0743e2ffda44a9a77de3bf7232c97
|
4
|
+
data.tar.gz: 8cd3f7603140afd8a4369f292d41d4ee5ee98096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba980d0945c38d6a751d32123cc8153b93801c45c6a549bdda31252ee9726ef9684f00aa1a76b791d40f0550baedec9d0260a30f1035c81c297d751fa824e074
|
7
|
+
data.tar.gz: 1098ab4fd884ae0a071a12379acbe458762bdf8c866b3115680099af8618805428d7036b350d5d4276d735e56ae50b92980304e49f228eabc10ee6beedfb44e6
|
data/workspace-media.rb
CHANGED
@@ -45,6 +45,16 @@ module Workspace
|
|
45
45
|
ensure image&.destroy!
|
46
46
|
end
|
47
47
|
|
48
|
+
def crop(x: 0, y: 0, width: nil, height: nil, quality: 85)
|
49
|
+
width = image.columns - x if width.nil?
|
50
|
+
height = image.rows - y if height.nil?
|
51
|
+
image = Magick::Image.read(to_s).first
|
52
|
+
image.crop!(x, y, width, height)
|
53
|
+
image.write(to_s) { self.quality = quality }
|
54
|
+
self
|
55
|
+
ensure image&.destroy!
|
56
|
+
end
|
57
|
+
|
48
58
|
def optimize!(image_max_width: nil, quality: 85, convert_jpg: true, optimize: true)
|
49
59
|
return false if !exists? or !image?
|
50
60
|
image = Magick::Image.read(to_s).first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workspace-media
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Strebitzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: workspace
|