This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-02-13 16:14:53

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

block problem :/

Hey Guys, here's a pretty useful block (I think nXIII made this, it might have been MathWizz though)

get web image: $String$

  | img newC |

    (t1 asLowercase endsWith: '.gif') ifTrue: [
        img _ (GIFReadWriter new setStream: (HTTPSocket httpGet: t1)) nextImage.]
    ifFalse: [
        (t1 asLowercase endsWith: '.png') ifTrue: [
            img _ (PNGReadWriter createAFormFrom: (HTTPSocket httpGet: t1) contents) first]
        ifFalse: [
            img _ HTTPSocket httpJpeg: t1]].

    newC _ ImageMedia new form: img; mediaName: (self unusedMediaNameFromBaseName: (self defaultImageMedia mediaName)).

    self addMediaItem: newC.

This block very amazingly imports web images as costumes to your Panther project.

One problem, it's not importing scratch project images... go to your projects, right click on one of the project thumbnails and select "copy image location" to get the image url, then paste it into the block an a red error message comes up... can anyone fix this?

thanks  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2 2011-02-13 17:06:41

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: block problem :/

It should accept png files, so I have no idea what's wrong...


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-02-14 09:53:30

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: block problem :/

Me either, but worse, when you try and go to the costumes tab a red error message pops up:

division by 0

Code:

SmallInteger(Object)>>error:
SmallInteger>>/
ImageMedia>>thumbnailFormExtent:
MediaItemMorph>>buildSubmorphs
MediaItemMorph>>scratchObj:media:
[] in ScratchSpriteMorph(ScriptableScratchMorph)>>costumesPage:
OrderedCollection>>do:
ScratchSpriteMorph(ScriptableScratchMorph)>>costumesPage:
ScratchScriptEditorMorph>>currentCategory:
ScratchTabPaneMorph>>currentTab:

Offline

 

#4 2011-02-14 10:53:19

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: block problem :/

nXIII made that block. Hmm... I can't reproduce it. What image are you getting?


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#5 2011-02-14 12:06:34

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: block problem :/

'image format not recognised' PNGReadWriter as a "costume" and unable to open costumes tab until the costume is deleted.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#6 2011-02-14 14:02:31

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: block problem :/

No, I mean what url is your image at?


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#7 2011-02-14 14:05:06

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: block problem :/

MathWizz wrote:

No, I mean what url is your image at?

get. on. hamachi. now. i. want. to. talk. now.

Offline

 

#8 2011-02-15 06:58:49

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: block problem :/

ProgrammingFreak wrote:

MathWizz wrote:

No, I mean what url is your image at?

get. on. hamachi. now. i. want. to. talk. now.

Stay. On. Topic.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#9 2011-02-15 10:39:15

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: block problem :/

the url is taken by copying the image source address. It can be the icon for a project such as

http://scratch.mit.edu/static/projects/Sheepworld/1598169_sm.png

or the icon for a username, such as

http://scratch.mit.edu/static/icons/buddy/183006_med.png

Oddly enough I can import the image for my scratch image without a problem

http://scratch.mit.edu/static/icons/buddy/183006_med.png?t=2010-08-29+11%3A58%3A09

(any idea why mine has a load of code after the .png and the others don't? it needs to be there for it to work...)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#10 2011-02-15 12:12:42

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: block problem :/

sparks wrote:

the url is taken by copying the image source address. It can be the icon for a project such as

http://scratch.mit.edu/static/projects/Sheepworld/1598169_sm.png

or the icon for a username, such as

http://scratch.mit.edu/static/icons/buddy/183006_med.png

Oddly enough I can import the image for my scratch image without a problem

http://scratch.mit.edu/static/icons/buddy/183006_med.png?t=2010-08-29+11%3A58%3A09

(any idea why mine has a load of code after the .png and the others don't? it needs to be there for it to work...)

Mine has it aswell.
http://scratch.mit.edu/static/icons/buddy/84283_med.png?t=2010-05-15+12%3A32%3A49
http://scratch.mit.edu/static/icons/buddy/84283_med.png?t=2010-05-15+12%3A32%3A49
http://scratch.mit.edu/static/icons/buddy/84283_med.png... It works with and without.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#11 2011-02-15 12:45:50

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: block problem :/

it works with and without here, but for the block, it's needed with. Consequently the block managed to load your picture, but still not nXIII's

Last edited by sparks (2011-02-15 12:59:51)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#12 2011-02-16 17:17:18

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: block problem :/

bump


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer