Class: JekyllImgFlow::Providers::CliBase

Inherits:
BaseProvider show all
Defined in:
lib/jekyll-imgflow/providers/base_provider.rb

Overview

Shared base for CLI-based providers (sharp, imagemagick, libvips). Subclasses implement build_commands(input_path, output_path) to return an array of command entries (strings or arrays), and run_command(cmd) to execute a single entry.

Direct Known Subclasses

Imagemagick, Libvips, Sharp

Constant Summary

Constants inherited from BaseProvider

BaseProvider::COMPASS_TO_SHORT, BaseProvider::KNOWN_OPERATIONS, BaseProvider::SMARTCROP_POSITIONS

Instance Attribute Summary

Attributes inherited from BaseProvider

#config

Instance Method Summary collapse

Methods inherited from BaseProvider

#add_watermark, #alpha_byte_value, #alpha_opacity=, #available?, #check_http_service, #cli_available?, #compass_to_short, #convert_format, #crop, #crop_coords, #crop_geometry, #encode_file_url, #find_op, #format, #initialize, #input_format_ext, #op?, #opacity, #operations, #optimize, provider_name, #quality, #quality=, #relative_file_path, #reset_operations, #resize, #smartcrop_interestingness, #supports_operation?, supports_operation?, #temp_path, unsupported_operations, #watermark, #watermark_parts

Constructor Details

This class inherits a constructor from JekyllImgFlow::Providers::BaseProvider

Instance Method Details

#execute(input_path, output_path) ⇒ Object



381
382
383
384
385
386
387
388
389
390
# File 'lib/jekyll-imgflow/providers/base_provider.rb', line 381

def execute(input_path, output_path)
  return if @operations.empty?

  before_execute(input_path)
  commands = build_commands(input_path, output_path)
  Array(commands).each { |cmd| run_command(cmd) }
  output_path
ensure
  reset_operations
end