Sensible defaults — users only need to configure originals and output
(or even nothing at all). All other values fall back to these.
"assets/images/originals"
DEFAULT_OUTPUT =
"assets/images/optimized"
DEFAULT_INPUT_FORMATS =
%w[jpgjpegpngwebpavifgiftifftifsvg].freeze
DEFAULT_FORMATS =
Output format priority: avif > webp > png > jpg (fallback).
The browser picks the first format it supports, so avif is
served to modern browsers, webp as a fallback for avif, png for
transparency, and jpg as the universal fallback.
# File 'lib/jekyll-imgflow/config.rb', line 24defbackend_priority@backend_priorityend
#fallback_format ⇒ Object(readonly)
Returns the value of attribute fallback_format.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24deffallback_format@fallback_formatend
#flyimg_url ⇒ Object(readonly)
Returns the value of attribute flyimg_url.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defflyimg_url@flyimg_urlend
#formats ⇒ Object(readonly)
Returns the value of attribute formats.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defformats@formatsend
#image_compressor_url ⇒ Object(readonly)
Returns the value of attribute image_compressor_url.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defimage_compressor_url@image_compressor_urlend
#imgproxy_url ⇒ Object(readonly)
Returns the value of attribute imgproxy_url.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defimgproxy_url@imgproxy_urlend
#input_formats ⇒ Object(readonly)
Returns the value of attribute input_formats.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24definput_formats@input_formatsend
#optimize_qualities ⇒ Object(readonly)
Returns the value of attribute optimize_qualities.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defoptimize_qualities@optimize_qualitiesend
#originals ⇒ Object(readonly)
Returns the value of attribute originals.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24deforiginals@originalsend
#output ⇒ Object(readonly)
Returns the value of attribute output.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defoutput@outputend
#quality ⇒ Object(readonly)
Returns the value of attribute quality.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defquality@qualityend
#site ⇒ Object(readonly)
Returns the value of attribute site.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defsite@siteend
#sizes ⇒ Object(readonly)
Returns the value of attribute sizes.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defsizes@sizesend
#weserv_url ⇒ Object(readonly)
Returns the value of attribute weserv_url.
24
25
26
# File 'lib/jekyll-imgflow/config.rb', line 24defweserv_url@weserv_urlend
Instance Method Details
#cache_dir ⇒ Object
59
60
61
# File 'lib/jekyll-imgflow/config.rb', line 59defcache_dirmerged_config["cache_dir"]||".cache/imgflow"end
#determine_version_type(params) ⇒ Symbol
Determine if params represent a default or specialized version
Parameters:
params(Hash)
—
Operation parameters
Returns:
(Symbol)
—
:default or :specialized
87
88
89
90
91
92
93
94
95
# File 'lib/jekyll-imgflow/config.rb', line 87defdetermine_version_type(params)ifparams[:width]&&@sizes.value?(params[:width])&&(!params[:format]||@formats.include?(params[:format]))&&(!params[:quality]||params[:quality]==@quality):defaultelse:specializedendend
#docker_config ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/jekyll-imgflow/config.rb', line 63defdocker_config{enabled:merged_config.key?("imgproxy_url")||merged_config.key?("weserv_url")||merged_config.key?("flyimg_url")||merged_config.key?("image_compressor_url"),imgproxy_url:@imgproxy_url,weserv_url:@weserv_url,flyimg_url:@flyimg_url,image_compressor_url:@image_compressor_url}end
#docker_enabled ⇒ Object
76
77
78
# File 'lib/jekyll-imgflow/config.rb', line 76defdocker_enableddocker_config[:enabled]end
#normalized_input_formats ⇒ Object
Get normalized format lists
123
124
125
# File 'lib/jekyll-imgflow/config.rb', line 123defnormalized_input_formats@input_formats.map(&:downcase)end
#normalized_output_formats ⇒ Object
127
128
129
# File 'lib/jekyll-imgflow/config.rb', line 127defnormalized_output_formats@formats.map(&:downcase)end
#sharp_url ⇒ Object
80
81
82
# File 'lib/jekyll-imgflow/config.rb', line 80defsharp_urlmerged_config["sharp_url"]end
#supported_input_format?(format) ⇒ Boolean
Format validation methods
Returns:
(Boolean)
98
99
100
101
# File 'lib/jekyll-imgflow/config.rb', line 98defsupported_input_format?(format)normalized_format=format.to_s.downcase.delete(".")@input_formats.map(&:downcase).include?(normalized_format)end
#supported_output_format?(format) ⇒ Boolean
Returns:
(Boolean)
103
104
105
106
# File 'lib/jekyll-imgflow/config.rb', line 103defsupported_output_format?(format)normalized_format=format.to_s.downcase.delete(".")@formats.map(&:downcase).include?(normalized_format)end
#validate_input_format!(format) ⇒ Object
Raises:
(ArgumentError)
108
109
110
111
112
113
# File 'lib/jekyll-imgflow/config.rb', line 108defvalidate_input_format!(format)returnifsupported_input_format?(format)raiseArgumentError,"Unsupported input format '#{format}'. Supported formats: #{@input_formats.join(', ')}"end
#validate_output_format!(format) ⇒ Object
Raises:
(ArgumentError)
115
116
117
118
119
120
# File 'lib/jekyll-imgflow/config.rb', line 115defvalidate_output_format!(format)returnifsupported_output_format?(format)raiseArgumentError,"Unsupported output format '#{format}'. Supported formats: #{@formats.join(', ')}"end