Current section

Files

Jump to
plug_image_processing lib plug_image_processing operations smartcrop.ex
Raw

lib/plug_image_processing/operations/smartcrop.ex

defmodule PlugImageProcessing.Operations.Smartcrop do
import PlugImageProcessing.Options
def new(image, params, _config) do
with {:ok, width} <- cast_integer(params["width"]),
{:ok, height} <- cast_integer(params["height"]) do
{:ok,
struct!(PlugImageProcessing.Operations.Crop, %{
image: image,
gravity: "smart",
width: width,
height: height
})}
end
end
end