Module: Dink::Helpers

Includes:
ActionView::Helpers
Defined in:
lib/dink/rails/helpers.rb

Instance Method Summary collapse

Instance Method Details

#dink!(source, process_options = {}, image_options = {}) ⇒ Object

Take image transform parameters and generate an image tag and stick it into the batch



6
7
8
9
10
11
# File 'lib/dink/rails/helpers.rb', line 6

def dink!(source, process_options = {}, image_options = {})
  image = Dink::Image.new(source, process_options).deliver
  Rails.logger.debug{ image.inspect }
  # @image_batch << image
  image_tag(image["results"]["url"], image_options)
end

#loggerObject

def stream_resize(image_source)

b = Benchmark.measure do
  @params = Addressable::URI.parse(url.to_s) # TODO get URI.parse out of Addressable to remove the dependency
  @params.query_values = {:image_source => image_source, :stream => "1"}
end
# logger.debug { "STREAM BENCHMARK :: #{b}" }

stream_url = url
stream_url.path = "/resize"
stream_url.query = @params.query
stream_url.to_s

end



26
27
28
# File 'lib/dink/rails/helpers.rb', line 26

def logger
  Dink.configuration.logger
end