Class: Imgproxy::OptionsBuilders::Processing

Inherits:
Base
  • Object
show all
Defined in:
lib/imgproxy/options_builders/processing.rb

Overview

Formats and regroups processing options

Constant Summary collapse

CASTERS =
{
  resize: Imgproxy::OptionsCasters::Resize,
  size: Imgproxy::OptionsCasters::Size,
  resizing_type: Imgproxy::OptionsCasters::String,
  resizing_algorithm: Imgproxy::OptionsCasters::String,
  width: Imgproxy::OptionsCasters::Integer,
  height: Imgproxy::OptionsCasters::Integer,
  "min-width": Imgproxy::OptionsCasters::Integer,
  "min-height": Imgproxy::OptionsCasters::Integer,
  zoom: Imgproxy::OptionsCasters::Zoom,
  dpr: Imgproxy::OptionsCasters::Float,
  enlarge: Imgproxy::OptionsCasters::Bool,
  extend: Imgproxy::OptionsCasters::Extend,
  extend_aspect_ratio: Imgproxy::OptionsCasters::Extend,
  gravity: Imgproxy::OptionsCasters::Gravity,
  crop: Imgproxy::OptionsCasters::Crop,
  trim: Imgproxy::OptionsCasters::Trim,
  padding: Imgproxy::OptionsCasters::Padding,
  auto_rotate: Imgproxy::OptionsCasters::Bool,
  rotate: Imgproxy::OptionsCasters::Integer,
  background: Imgproxy::OptionsCasters::Background,
  background_alpha: Imgproxy::OptionsCasters::Float,
  adjust: Imgproxy::OptionsCasters::Adjust,
  brightness: Imgproxy::OptionsCasters::Integer,
  contrast: Imgproxy::OptionsCasters::Float,
  saturation: Imgproxy::OptionsCasters::Float,
  blur: Imgproxy::OptionsCasters::Float,
  sharpen: Imgproxy::OptionsCasters::Float,
  pixelate: Imgproxy::OptionsCasters::Integer,
  unsharp_masking: Imgproxy::OptionsCasters::UnsharpMasking,
  blur_detections: Imgproxy::OptionsCasters::BlurDetections,
  draw_detections: Imgproxy::OptionsCasters::DrawDetections,
  gradient: Imgproxy::OptionsCasters::Gradient,
  watermark: Imgproxy::OptionsCasters::Watermark,
  watermark_url: Imgproxy::OptionsCasters::Base64,
  watermark_text: Imgproxy::OptionsCasters::Base64,
  watermark_size: Imgproxy::OptionsCasters::WatermarkSize,
  watermark_shadow: Imgproxy::OptionsCasters::Float,
  style: Imgproxy::OptionsCasters::Base64,
  strip_metadata: Imgproxy::OptionsCasters::Bool,
  keep_copyright: Imgproxy::OptionsCasters::Bool,
  dpi: Imgproxy::OptionsCasters::Float,
  strip_color_profile: Imgproxy::OptionsCasters::Bool,
  enforce_thumbnail: Imgproxy::OptionsCasters::Bool,
  quality: Imgproxy::OptionsCasters::Integer,
  format_quality: Imgproxy::OptionsCasters::FormatQuality,
  autoquality: Imgproxy::OptionsCasters::Autoquality,
  max_bytes: Imgproxy::OptionsCasters::Integer,
  jpeg_options: Imgproxy::OptionsCasters::JpegOptions,
  png_options: Imgproxy::OptionsCasters::PngOptions,
  webp_options: Imgproxy::OptionsCasters::WebpOptions,
  format: Imgproxy::OptionsCasters::String,
  page: Imgproxy::OptionsCasters::Integer,
  pages: Imgproxy::OptionsCasters::Integer,
  disable_animation: Imgproxy::OptionsCasters::Bool,
  video_thumbnail_second: Imgproxy::OptionsCasters::Integer,
  video_thumbnail_keyframes: Imgproxy::OptionsCasters::Bool,
  video_thumbnail_tile: Imgproxy::OptionsCasters::VideoThumbnailTile,
  fallback_image_url: Imgproxy::OptionsCasters::Base64,
  skip_processing: Imgproxy::OptionsCasters::Array,
  raw: Imgproxy::OptionsCasters::Bool,
  cachebuster: Imgproxy::OptionsCasters::String,
  expires: Imgproxy::OptionsCasters::Integer,
  filename: Imgproxy::OptionsCasters::Filename,
  return_attachment: Imgproxy::OptionsCasters::Bool,
  preset: Imgproxy::OptionsCasters::Array,
  hashsum: Imgproxy::OptionsCasters::Hashsum,
  max_src_resolution: Imgproxy::OptionsCasters::Float,
  max_src_file_size: Imgproxy::OptionsCasters::Integer,
  max_animation_frames: Imgproxy::OptionsCasters::Integer,
  max_animation_frame_resolution: Imgproxy::OptionsCasters::Float,
}.freeze
META =
%i[size resize adjust].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Processing

Returns a new instance of Processing.



115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/imgproxy/options_builders/processing.rb', line 115

def initialize(options)
  super

  # Legacy name for unsharp_masking
  if options.key?(:unsharpening)
    warn "[DEPRECATION] `unsharpening` option is deprecated. Please use `unsharp_masking` instead."
    delete(:unsharpening)
    unless key?(:unsharp_masking)
      self[:unsharp_masking] = CASTERS[:unsharp_masking].cast(options[:unsharpening])
    end
  end
end