Comment puis-je ajouter du texte sur une image en utilisant la toile de html5?

StackOverflow https://stackoverflow.com/questions/6813957

  •  25-10-2019
  •  | 
  •  

Question

Je veux ajouter du texte sur une image en utilisant HTML5. Comment cela peut-il être fait?

Était-ce utile?

La solution

You can load the image into a canvas (using drawImage()), then draw text on the canvas (using fillText()).

If you want to you can then take the image data from the canvas using toDataUrl() and post that data to the server for image persistence.

If you only need it for client side visibility you have a much simpler solution that doesn't use html5. just overlay a text over the image using absolute positioning.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top