So, I've been making a Snap! project that connects to the Scratch API to get data such as projects, news, etc. And I want to get images from it, but it just gives me the .PNG TEXT, not a costume.
How do I convert this into a costume?
These ^^ are getting pictures for the scratch news
There's actually a built in extension function to do that.
As far as I know, it's not used in any library, so you need to turn on extension blocks, drag the primitive reporter out, and then select
cst_load(url) and then put the url in the first input.
I recommend creating a custom block for this, specifically for more readability, and so you can easily get the function without searching through a long dropdown.
Also for some reason, snap just freezes whenever I try to get a result pic of the block (getting a costume from url, everything else works just fine). I don't know if has anything to do with me being on mobile.
Oh, and if you're just getting an image, you don't need the cors proxy.
Hm, i wonder if i can use this to decrease a project's file size...
I wouldn’t say because there’s tons of downsides to hosting costumes on their own site
You would have to do a web request for every costume, meaning it would be highly dependent on the internet speed of the user and what if they are offline or have something blocking it?
well, what if i host the costumes all in one SCRATCH project?
or mabye use the new costume block? will that decrease project size?
Technically yes but that’s much much more complex then just putting the costume in
Vectors don’t take up much space anyway