Basic
On-demand image creation by secure URL parameters
def create_signed_image do
user_id = ""
secret_key = ""
base_id = ""
modifications =
Jason.encode!([
%{"name" => "text_1", "text" => "secure image"},
%{"name" => "rating_2", "rating" => 5}
])
|> Base.url_encoded64(padding: false)
parameters = "#{user_id}+#{base_id}+#{modifications}"
signature =
:crypto.hmac(:sha256, secret_key, parameters)
|> Base.encode16()
|> String.downcase()
"https://images.usestencil.com/signed-images/#{user_id}/#{base_id}.png?modifications=#{modifications}&s=#{signature}"
endChanging image format on the fly
Cache
Cache invalidation
Last updated