camaleon_image_optimizer 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 558b329de97ae0c60960f04bfaa2a00985aeaa517e4658318615885934c23197
4
- data.tar.gz: b2133d331c8c4a7529bca995111985106bf8675381626cdbe6fd85036e4f4d0b
3
+ metadata.gz: 2e60040d7a6d80e6c40da8401f4df1d5c28f6b7c1509bbec1fcd4c037353e909
4
+ data.tar.gz: 91d60e7de6e09305f4dfb05a8a4b51014d284cbbb2ab0214819211c964338926
5
5
  SHA512:
6
- metadata.gz: 6bf54d5f1ba4e21c8abe0578fe72e5fb27cc49a48ed5b5b49b8a533e6823c681689945cf1d1821173fb3152c48a7cf265b662df05393439775744090d7c698ed
7
- data.tar.gz: 3d14156b6f0e1646f46da31a752a667cfe32e9b344eb7012c571391544a99e9797374e1fc53a9dbaec995acce3f48e9a10d1a649bd434652d2e22713cdd3f725
6
+ metadata.gz: e9d717a08310badad8ef8956a3af0722f14feb3cc7e9f19d134202341caf148e97cca4656ad240db59cc526c5d3a68a324f030a6b2224f73d3c4d3a916e7a0e5
7
+ data.tar.gz: d74f2e68ed11bef999b721438aaa5fab5416e10cc2292be7719229a5e3fbf452f92880a405d0bcb93dc21a07d4d71761c16e5b88f5deb972b123d4c5bf1c33d3
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Camaleon Image Optimizer
2
- This is a convenient image optimizer plugin for Camaleon CMS. Compressing images improves load times and thus SEO. It uses the [image_optim_rails gem](https://github.com/toy/image_optim_rails) under the hood. Currently no settings are exposed in Camaleon, but that may happen in the future. Until then, the default settings will still compress quite a bit without sacrificing quality.
2
+ This is a convenient image optimizer plugin for Camaleon CMS. Compressing images improves load times and thus SEO. It uses the [image_optim gem](https://github.com/toy/image_optim) under the hood. This gem contains multiple utilities for compressing GIF, JPEG, PNG, and SVG files. My experience has been that GIFs JPEGs are easily crushable with these tools, but using multiple PNG compressors is extremely slow. Thus, only one of the PNG compressors is enabled here.
3
+
4
+ Currently the only setting exposed by the plugin is `max_quality`, affecting JPEG and PNG images. Please note that setting this to the maximum will still result in some compression.
3
5
 
4
6
  ## Installation
5
7
  Add this line to your application's Gemfile:
@@ -18,6 +20,11 @@ Or install it yourself as:
18
20
  $ gem install camaleon_image_optimizer
19
21
  ```
20
22
 
23
+ If you need support for compressing SVG files, install [SVGO](https://github.com/svg/svgo). Note that you need to do this on your production server, and you must first have NPM installed.
24
+ ```bash
25
+ $ npm install -g svgo
26
+ ```
27
+
21
28
  ## Usage
22
29
  Just activate the plugin in Camaleon's admin panel.
23
30
 
@@ -34,7 +34,10 @@ private
34
34
 
35
35
  def camaleon_image_optimizer_settings
36
36
  @camaleon_image_optimizer_settings ||= camaleon_image_optimizer_default_settings.tap do |cios|
37
- cios['jpegoptim']['max_quality'] = current_plugin.get_option('quality') unless current_plugin.get_option('quality').blank?
37
+ unless current_plugin.get_option('quality').blank?
38
+ cios['jpegoptim']['max_quality'] = current_plugin.get_option 'quality'
39
+ cios['pngquant']['quality'] = (0..current_plugin.get_option('quality'))
40
+ end
38
41
  end
39
42
  end
40
43
 
@@ -1,17 +1,127 @@
1
- # see https://github.com/toy/image_optim for config options
2
- skip_missing_workers: true
3
- pngout: false
4
- svgo: false
1
+ # see https://github.com/toy/image_optim for more info
2
+
5
3
 
4
+ ### Global options ###
5
+
6
+ # Allow lossy workers and optimizations (defaults to false)
6
7
  allow_lossy: true
7
- advpng: false
8
+
9
+ # Configure cache directory
10
+ # cache_dir:
11
+
12
+ # Also cache worker digests along with original file digest and worker options.
13
+ # Updating workers invalidates cache
14
+ # cache_worker_digests:
15
+
16
+ # Nice level, system priority of all used tools with higher value meaning lower
17
+ # priority, in range -20..19, negative values can be set only if run by root
18
+ # user (defaults to 10)
19
+ # nice:
20
+
21
+ # Require image_optim_pack or disable it, by default image_optim_pack will be
22
+ # used if available, will turn on :skip-missing-workers unless explicitly
23
+ # disabled (defaults to nil)
24
+ # pack:
25
+
26
+ # Skip workers with missing or problematic binaries (defaults to false)
27
+ skip_missing_workers: true
28
+
29
+ # Number of threads or disable (defaults to number of processors)
30
+ # threads:
31
+
32
+ # Verbose output (defaults to false)
33
+ # verbose:
34
+
35
+
36
+ ### Worker options ###
37
+ # Each worker below can be disabled by passing false instead of options hash or
38
+ # by setting option :disable to true
39
+
40
+ ### GIF ###
41
+ # gifsicle:
42
+ # true/false = interlace on/off, nil = as is in original image (defaults to
43
+ # running two instances, one with interlace off and one with on)
44
+ # interlace:
45
+ # Compression level: 1 - light and fast, 2 - normal, 3 - heavy (slower) (defaults to 3)
46
+ # level:
47
+ # Avoid bugs with some software (defaults to false)
48
+ # careful:
49
+
50
+ # JPEG
51
+ # jhead: # Worker has no options
52
+
8
53
  jpegoptim:
54
+ # Allow limiting maximum quality (defaults to false)
9
55
  allow_lossy: true
56
+ # Maximum image quality factor 0..100, ignored in default/lossless mode (defaults to 100)
10
57
  max_quality: 70
58
+ # List of extra markers to strip: :comments, :exif, :iptc, :icc or :all (defaults to :all)
59
+ # strip:
60
+
11
61
  jpegrecompress:
62
+ # Allow worker, it is always lossy (defaults to false)
12
63
  allow_lossy: true
64
+ # JPEG quality preset: 0 - low, 1 - medium, 2 - high, 3 - veryhigh (defaults to 3)
13
65
  quality: 0
66
+
67
+ # jpegtran:
68
+ # Copy all chunks (defaults to false)
69
+ # copy_chunks:
70
+ # Use jpegtran through jpegrescan, ignore progressive option (defaults to true)
71
+ # jpegrescan:
72
+ # Create progressive JPEG file (defaults to true)
73
+ # progressive:
74
+
75
+ # PNG (using multiple workers on PNG is slow, so most are disabled in this config.)
76
+ advpng: false
77
+ # Compression level: 0 - don't compress, 1 - fast, 2 - normal, 3 - extra, 4 - extreme
78
+ # (defaults to 4)
79
+ # level:
80
+
14
81
  optipng: false
82
+ # Optimization level preset: 0 is least, 7 is best (defaults to 6)
83
+ # level:
84
+ # true/false = interlace on/off, nil = as is in original image (defaults to false)
85
+ # interlace:
86
+ # Remove all auxiliary chunks (defaults to true)
87
+ # strip:
88
+
15
89
  pngcrush: false
90
+ # List of chunks to remove or :alla - all except tRNS/transparency or :allb -
91
+ # all except tRNS and gAMA/gamma (defaults to :alla)
92
+ # chunks:
93
+ # Fix otherwise fatal conditions such as bad CRCs (defaults to false)
94
+ # fix:
95
+ # Brute force try all methods, very time-consuming and generally not worthwhile
96
+ # (defaults to false)
97
+ # brute:
98
+ # Blacken fully transparent pixels (defaults to true)
99
+ # blacken:
100
+
101
+ pngout: false # not included in image_optim_pack gem
102
+ # Copy optional chunks (defaults to false)
103
+ # copy_chunks:
104
+ # Strategy: 0 - xtreme, 1 - intense, 2 - longest Match, 3 - huffman Only, 4 - uncompressed (defaults to 0)
105
+ # strategy:
106
+
16
107
  pngquant:
108
+ # Allow quality option (defaults to false)
17
109
  allow_lossy: true
110
+ # Maximum number of colors to use (defaults to 256)
111
+ # max_colors:
112
+ # min..max - don't save below min, use less colors below max (both in range
113
+ # 0..100; in yaml - !ruby/range 0..100), ignored in default/lossless mode
114
+ # (defaults to 100..100, 0..100 in lossy mode)
115
+ quality: !ruby/range 0..70
116
+ # speed/quality trade-off: 1 - slow, 3 - default, 11 - fast & rough (defaults to 3)
117
+ # speed:
118
+
119
+ # SVG
120
+ # SVGO list of plugins is here: https://github.com/svg/svgo. Note that each
121
+ # plugin has its own enabled/disabled default, so this worker will be effective
122
+ # even with enable_plugins set to [].
123
+ # svgo: false # not included in image_optim_pack gem
124
+ # List of plugins to disable (defaults to [])
125
+ # disable_plugins:
126
+ # List of plugins to enable (defaults to [])
127
+ # enable_plugins:
@@ -1,3 +1,3 @@
1
1
  module CamaleonImageOptimizer
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_image_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Kephart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-25 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: camaleon_cms