Skip to content

Part image/attachment from URL #1306

Closed

Description

@ivladz

It would be great to be able to add a part image and/or part attachment directly from an URL. Right now you have to download the image/document locally and then upload via GUI.
This together with #623 would make for a great usability improvement.

Activity

  1. SchrodingersGat commented on Feb 17, 2021

    @SchrodingersGat
    Member

    Agreed it would be a great productivity increase. I am just unsure on exactly how to best implement it:

    • Technical requirements
    • Support for browsers
    • Security issues?
  2. added
    enhancement
    on Feb 17, 2021
  3. eeintech commented on Feb 17, 2021

    @eeintech
    Contributor

    I think a simple wget (or any other web scrapping Python library) should work to grab the image from the URL and set it as main picture?

  4. SchrodingersGat commented on Feb 17, 2021

    @SchrodingersGat
    Member

    Getting the image from the web is pretty straight-forward, but how to tell the server which image to download?

    A) Copy and paste the URL?
    B) Drag and drop the image from the browser? (Preferred)

    if B) then I am not yet aware of a good way to extract the URL from a drag-and-dropped image

  5. ivladz commented on Feb 17, 2021

    @ivladz
    Author

    I was thinking of method A, have a URL box in the Image upload form:
    image
    Where you would paste an image link from the web (for example https://inventree.readthedocs.io/en/latest/assets/images/api/api_doc.png).

    This would make a 2-step process (download the file locally, then uploading it via the existent functionality) into 1-step fast process. I guess the only "drawback" on this method is that the Inventree server requires internet access (don't know if right now it really needs it for something).

  6. eeintech commented on Feb 17, 2021

    @eeintech
    Contributor

    I was also thinking A) because it's easy enough to right-click on the image and directly get the URL.

    A check for internet access would be needed indeed.

  7. SchrodingersGat commented on Feb 17, 2021

    @SchrodingersGat
    Member

    It should not be too hard to implement it this way. However there is a level of "user trust" here, exposing the server directly to the internet!

  8. eeintech commented on Mar 10, 2021

    @eeintech
    Contributor

    @SchrodingersGat Agree but I think it comes down to the same level of trust for user to download the image on their local machine then upload it to InvenTree. Whatever is embedded in the "image" file will persist. This would just cut the middle man (eg. local machine). What do you think?

  9. SchrodingersGat commented on Mar 15, 2021

    @SchrodingersGat
    Member

    Sure, it's the same on the "client side" of user trust.

    I guess that on the server side, we could ensure that the code to actually download the image performs a bunch of checks:

    • The URL looks like an image
    • Only download a certain maximum file size
    • Sanitize the image after download
    • Handle plethora error cases
  10. eeintech commented on Mar 16, 2021

    @eeintech
    Contributor

    This sounds like a fun little project 😄

  11. SchrodingersGat commented on Mar 16, 2021

    @SchrodingersGat
    Member

    Work in progress here - #1410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions