}
) do
conn
- |> put_resp_header("content-type", "image/png")
- |> put_resp_header("content-disposition", "inline; filename=\"preview.png\"")
+ |> put_preview_response_headers()
|> send_resp(200, thumbnail_binary)
else
_ ->
%{max_width: thumbnail_max_width, max_height: thumbnail_max_height, quality: quality}
) do
conn
- |> put_resp_header("content-type", "image/jpeg")
- |> put_resp_header("content-disposition", "inline; filename=\"preview.jpg\"")
+ |> put_preview_response_headers()
|> send_resp(200, thumbnail_binary)
else
_ ->
with {:ok, thumbnail_binary} <-
MediaHelper.video_framegrab(url) do
conn
- |> put_resp_header("content-type", "image/jpeg")
- |> put_resp_header("content-disposition", "inline; filename=\"preview.jpg\"")
+ |> put_preview_response_headers()
|> send_resp(200, thumbnail_binary)
else
_ ->
end
end
+ defp put_preview_response_headers(conn) do
+ conn
+ |> put_resp_header("content-type", "image/jpeg")
+ |> put_resp_header("content-disposition", "inline; filename=\"preview.jpg\"")
+ |> put_resp_header("cache-control", "max-age=0, private, must-revalidate")
+ end
+
defp thumbnail_max_dimensions(params) do
config = Config.get([:media_preview_proxy], [])