Closed edi233 closed 7 years ago
Is your page served from the file system or a (local) web server? I guess file:// is not applicable in your case. Can you reference the image with a relative path?
yes, I want to load image from internal storage my phone with android. On Blockly page I find advice to use Blockly.pathToBlockly but I don't know how can I do that. I don't want to use web server for icons, I need load them from internal storage my phone.
I see, but is the blockly file served from the same/parent /sibling directory as the image?
See Blockly.Blocks['text'] lines 32-33 and 35-36 for an example of Blockly.pathToBlockly. (You can use it after the "src": as well.) Warning! This is an older version of Blockly from 2013 (NOT the current branch by Google), but the example should work.
Assuming you are loading your .html containing Blockly from the assets, also, can you use a relative URL? No leading slash. Parent directory references (../
) should be allowed.
Alternatively, use a data:
URI. Try a converter like this one: http://websemantics.co.uk/online_tools/image_to_data_uri_convertor/
This is how we do the quotes on the text blocks: https://github.com/google/blockly/blob/7928fac3cebd4ba310d94727e7b32ead06cb16b0/blocks/text.js#L68
ok, I find what was wrong in code. I use new .arr files from blockly, but only with release .arr file works. For debug .arr nothing happen in code. So when I build release version my app I could see icons, for debug I can't see changes.
It sounds like you're using the Android build. If so, let's move the discussion to blockly-android or to the general mailing list. This repo is for the web version.
Hello, I want to create custom block where I want to add my own icon from assets. I create block: