문제

i try this for long time how can add the image to canvas in html or php only i got the image path i need to load the image to canvas in html or php,i don't need to add the image through jquery or javascript

in html i try this.

<canvas id="myCanvas" width="500" height="500" style="border:1px solid #000000;">
<img src="" alt="Resized Image" height="200px"     
width="200px"></canvas>
도움이 되었습니까?

해결책

There are a few ways to accomplish this.

First, there is a slightly hackish way to do it by setting the background image in css like this:

<canvas id="myCanvas" width="500" height="500" style="border:1px solid #000000;background-image:url('path/to/your/image.ext')">
</canvas>

This will work fine if you just want to display the image, however, I'm assuming that you want to actually manipulate it. In that case, check out this answer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top