Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow storage of based on external URLs? #51

Closed
johnnyji opened this issue Nov 3, 2016 · 2 comments
Closed

Allow storage of based on external URLs? #51

johnnyji opened this issue Nov 3, 2016 · 2 comments

Comments

@johnnyji
Copy link

johnnyji commented Nov 3, 2016

@stavro

Is it possible to add an option to store the image based on an external URL, filename and scope? Def.store(%{filename: '....', path: 'blob:http://localhost:4000/sdfsfsfd.jpg'}, my_scope)

Currently even though there's a pattern match to accept this, it doesn't work because it uses File.exists? to check if the file is temp stored in Phoenix. Which this file isn't, so this returns an error, even though the URL is technically still valid:

  def new(%{filename: filename, path: path}) do
    case File.exists?(path) do
      true -> %Arc.File{path: path, file_name: filename}
      false -> {:error, :invalid_file_path}
    end
  end

I'd love to have support for storing images based on external source URL and a filename. This would be a huge convenience because users will no longer need to send FormData in order to generate the Plug.Upload struct.

PS. Thanks for the amazing library!

@stavro
Copy link
Owner

stavro commented Nov 3, 2016

This is in master of Arc.

Def.store({"https://google.com/favicon.ico", scope})

@stavro stavro closed this as completed Nov 3, 2016
@stavro
Copy link
Owner

stavro commented Nov 3, 2016

You can't pass blob urls around though - if that url is generated during a browser session then it won't be accessible anywhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants