- """
- # XXX: does this code actually work? i am skeptical. --kaniini
- def store(%{"img" => "data:image/" <> image_data}, should_dedupe) do
- settings = Application.get_env(:pleroma, Pleroma.Upload)
- use_s3 = Keyword.fetch!(settings, :use_s3)
-
- parsed = Regex.named_captures(~r/(?<filetype>jpeg|png|gif);base64,(?<data>.*)/, image_data)
- data = Base.decode64!(parsed["data"], ignore: :whitespace)
- uuid = UUID.generate()
- uuidpath = Path.join(upload_path(), uuid)
- uuid = UUID.generate()
-
- File.mkdir_p!(upload_path())
-
- File.write!(uuidpath, data)
-
- content_type = get_content_type(uuidpath)