Filesystem plugin: Load local image files without the need for a server?

0 favourites
  • 3 posts
From the Asset Store
In this template the music plays without looping in your game
  • I've been tinkering around with a sideproject of mine. Lets say it boils down to be an image viewer. I've set it up like this:

    1. I use the Filesystem Plugin to open a folder and get a list of all files

    2. I loop through the files and create a bunch of image elements inside an html element

    3. The image elements get the source like this: <img src="localhost:8080/[filename.png]></img>

    This setup works very well and quick even for a ton of images BUT it requires me to setup the folder as server. I currently use a simple python script. Not only is there no way to get the path to the folder I selected (unless I'm missing it), even if I hardcode the path in like <img src="C:\test[filename.png]"></img> the image cannot be loaded due to browser restrictions.

    Now I'm thinking since I open the folder via the filesystem plugin, I'm already giving my browser read/write access to that folder. So I should be able to access these images, right? How could I achive this?

    Or option 2: Is there a way from inside construct (with js or plugin) to automatically host a local server from a folder. I'm guessing something like node.js? I'd prefer option 1 though, it seems simpler and basically there already... I feel like that should work out of the box, no?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The File System plugin can read binary files in to a Binary Data object. Then you can use the GetURL expression of the Binary Data object to get a URL to that data, which you can then use in places like an <img> tag.

  • Ohhh I'm gonna try that asap. I suspected the binary data object but I haven't ever used it yet. Thanks!

    Unlucky that I already sort of went ahead and also made my server generate videothumbails... but maybe I can also figure that out in Construct :V

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)