class PhotographicMemory
An image processing client that uses ImageMagick's convert and an AWS S3-like API for storage.
@example
client = PhotographicMemory.new
(@config) client.put file: image, id: 123
@param [Hash] config @param [String] config - The application environment. Is optional and only changes behavior with the string “test”, which stubs S3 responses and prevents calls to Rekognition. @param [String] config - The region to use for S3. Only relevant when actually using AWS S3. @param [String] config - The endpoint to use for S3 calls. Only required when using your own S3-compatible storage medium. @param [Boolean] config - Forces path style for S3 API calls. Defaults to true. @param [String] config - The access key ID for S3 calls. @param [String] config - The secret access key for S3 calls. @param [string] config - The signature version for S3 calls. Defaults to 's3'. @param [string] config - The access key ID for Rekognition calls. @param [string] config - The secret access key for Rekognition calls. @param [string] config - The region for Rekognition calls.
Attributes
Public Class Methods
# File lib/photographic_memory.rb, line 34 def initialize config={} @config = config options = { region: config[:s3_region], endpoint: config[:s3_endpoint], force_path_style: config[:s3_force_path_style] || true, credentials: Aws::Credentials.new( config[:s3_access_key_id], config[:s3_secret_access_key] ), stub_responses: config[:environment] === "test", signature_version: config[:s3_signature_version] || "s3" }.select{|k,v| !v.nil?} @s3_client = Aws::S3::Client.new(options) end
Public Instance Methods
# File lib/photographic_memory.rb, line 50 def put file:, id:, style_name:"original", convert_options: [], content_type: unless (style_name == "original") || convert_options.empty? if content_type.match "image/gif" output = render_gif file, convert_options else output = render file, convert_options end else output = file.read end