tonetheman's blog

phaser3 data uri for images

So if you want to use a data uri as a texture in phaser3 this is how you do it.

You need to create an Image in Javascript (this is not a Phaser3 Image) Once it loads you create a Phaser3 texture and "draw" the Javascript Image onto it.

let img = new Image();  //1
img.onload = () => {
  const canvasTexture = scene.textures.createCanvas(
  const ctx = canvasTexture.getContext();
  ctx.drawImage(img, 0, 0);

An example

What is a data uri

Javascript Image (MDN)

Good Phaser3 information here