Skip to content
Clément Cariou edited this page Mar 28, 2021 · 7 revisions

How to use custom artworks ?

  1. Setup the project
  2. Put your images into the folder images
  3. Depending on what you want to do :
  • Run the server npm start, go to the address displayed in the terminal
  • Build the project npm build, and host the build.html file and the image folder
  1. Append ?api=local to the browser url bar (you can set the default API in api/api.js)

How to add an API connector ?

You can add an API by adding a js file in the api folder and importing it in api/api.js. It should exports a module with two asynchronious functions :

/** Called when a new page of image objects needs to be loaded
 * @param {number} from - starting index
 * @param {number} to - end index
 * @returns {{image_id: number, ...}[]}: list of image objects
*/
fetchList(from, to)

/** Called to load an image
 * @param {Img} obj - image object
 * @param {number} advicedResolution - image resolution adviced by the dynamic loader
 * @returns {{title: string, image: Blob|ImageData|HTMLCanvasElement...}} - title and image to display
*/
fetchImage(obj, advicedResolution)

You can take a look at the existing APIs for reference. I will be happy to accept Pull Request of API connectors.

Clone this wiki locally