Class: Imgproxy::UrlBuilders::Info

Inherits:
Base
  • Object
show all
Defined in:
lib/imgproxy/url_builders/info.rb

Overview

Builds imgproxy info URL

builder = Imgproxy::UrlBuilders::Info.new(
  width: 500,
  height: 400,
  resizing_type: :fill,
  sharpen: 0.5
)

builder.url_for("http://images.example.com/images/image1.jpg")
builder.url_for("http://images.example.com/images/image2.jpg")

Constant Summary collapse

OPTIONS_BUILDER =
OptionsBuilders::Info
OPTION_ALIASES =
Imgproxy::OptionAliases::INFO

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Info

Returns a new instance of Info.

Parameters:

  • options (Hash) (defaults to: {})

    Info options

See Also:



26
27
28
# File 'lib/imgproxy/url_builders/info.rb', line 26

def initialize(options = {})
  super
end

Instance Method Details

#url_for(image) ⇒ String

Genrates imgproxy info URL

Parameters:

  • image (String, URI, Object)

    Source image URL or object applicable for the configured URL adapters

Returns:

  • (String)

    imgproxy info URL

See Also:



36
37
38
39
40
41
# File 'lib/imgproxy/url_builders/info.rb', line 36

def url_for(image)
  path = [*option_strings, sourcce_url(image)].join("/")
  signature = sign_path(path)

  File.join(endpoint.to_s, "info", signature, path)
end