How do I create an image when app is running using filedrop

Get help using Construct 2

Post » Thu Aug 25, 2016 8:36 pm

The idea is drag an image on your pc folders and drop into the app window and show as an sprite.

At the moment i get how to create a sprite when an image is dropped in the windows and set their binary data inside the Base64 variable of the sprite.

Here is the capx.
https://dl.dropboxusercontent.com/u/659 ... drop1.capx

So, or i find someway to convert that binary data into Base64 or directly set the sprite an image using the binary data.

In case the convert to Base64 is correct the events are done so the image will appears.

Also you will need this behaviour to open the .capx. Is a behaviour to extract the Base64 from an image:
viewtopic.php?f=153&t=68494&p=873882&hilit=pode+base64+extract
But can convert the binary data to Base64 seems :( .

Any idea?
B
26
S
10
G
3
Posts: 584
Reputation: 4,595

Post » Thu Aug 25, 2016 10:32 pm

matriax wrote:The idea is drag an image on your pc folders and drop into the app window and show as an sprite.


NWjs On file dropped--------------Sprite load image from NWjs.DroppedFile

why you need Base64?
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Aug 26, 2016 6:57 am

Ah! i don't know the sprite load image also get that. (I knew URL and URI(base64 but not also binary data)

I'm using Base64 for store the image data in a variable. So after i save all values in an array and export the array.asJSON,etc...

So in a new running of the app if you load that .json all the composition and images are loaded.

Then, seems i can store the binary data in a variable instead the Base64 to after apply using Load image URL? I'm going to try it! :D
B
26
S
10
G
3
Posts: 584
Reputation: 4,595

Post » Fri Aug 26, 2016 8:24 am

@korbaach I'm looking the variable to store the image data and the NWjs.DroppedFile saves the folder direction of the image in the PC not the data. So if i export the sprite data .jSON if somebody in other PC loads its if not have the image in the same folder none image will be loaded. For that i used Base64 because i not found another way to save data in .JSON.

Is there anyway to manipulate binarydata in the sameway as Base64?

Also when a file is dropped all the sprites changes their image to the last image dropped, because they share the same image texture.

How i can tell that every time a file is dropped creates a new sprite and load an image without share it with an other instance of the sprite? Or not is possible? And in case of not, how solve it to drop various image files and show all the diferent images??
B
26
S
10
G
3
Posts: 584
Reputation: 4,595

Post » Fri Aug 26, 2016 12:41 pm

I'm really not an expert..but for multiple images you need multiple frames..
then pick instance with id 1..set frame to 1 ..load image from dropped file ..on image loaded extract to base 64(with Pode behavior)..
or you can try with some SpriteHelper..load image,then extract to base64..push to Array..then load Sprite image fom array...
:?
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Aug 26, 2016 1:20 pm

Yep, i design the same solution XD. Create a .gif with 1000 frames of 1x1 pixels and load it on the sprite, in animation called "Imported image".

So if the sprite Base64 variable is different of "" then set animation to "Imported image", set frame to Zorder variable of the sprite and load image using the Base64 variable data.

---

Will be great if there is some way to "object-clone" action so will have an sprite object with the same properties but without share the image texture. Or an option in the Sprite properties of an object on you can say "Share image texture with other instances: Yes/No" and problem resolved. What you think @ashley , this can be a new feature or there is another way to fix the problem we're missing?
B
26
S
10
G
3
Posts: 584
Reputation: 4,595


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests