scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.46k stars 3.56k forks source link

Add loading sprites from URLs #2371

Open niccokunzmann opened 6 years ago

niccokunzmann commented 6 years ago

Expected Behavior

Please describe what should happen

When I add a new sprite e.g. for minecraft, I surf the internet, find a picture. I would like to include this picture by its URL.

Actual Behavior

Describe what actually happens

I need to download and save the picture. Then, I can upload it from my computer.

Steps to Reproduce

Explain what someone needs to do in order to see what's described in Actual behavior above

  1. Click on the Sprite+ Button in the bottom-right corner.
  2. Click on upload

Operating System and Browser

Firefox 52, Linux

towerofnix commented 6 years ago

I'm not sure this is (entirely) possible, because many sites prevent cross-origin resource sharing (CORS). So, if Scratch tries to make a fetch to download an image on a domain without CORS, the browser prevents the request and the image doesn't load. Snap!, an editor/programming language based on Scratch, does let you drag an image from a separate webpage to load it into the editor, but if you try to drag in an image from somewhere that blocks CORS, it'll show a message. Implementing this into Scratch would have to work the same way.

bowstones commented 6 years ago

@towerofnix I can't see a problem with it working that way, but something would need to be added to the URL pasting window to let people know not to post the failure of this feature in the Suggestions or Bugs & Glitches forum. Obviously which sites will/won't allow CORS requests is beyond ST's control.

hedgehog125 commented 6 years ago

Maybe a compromise could be that you could drag and drop from your computer?

niccokunzmann commented 6 years ago

Dragging and dropping would be a great compromise.

  1. You do not need to open the upload window.
  2. this allows dragging and dropping it from other browser windows as I understand.

This way, it is fast and in many cases  a familiar interaction for users.

bowstones commented 6 years ago

@hedgehog125 @niccokunzmann I can see many problems with this: