简体   繁体   English

我想动态地将数字放在图像上

[英]I want to put number on a image dynamically

I want to put number on a image dynamically.我想动态地将数字放在图像上。

Take two div's.取两个div。 Set backgroung image for one div and put some number on another div.为一个 div 设置背景图像并将一些数字放在另一个 div 上。 Place the second div on first div by using css properties like position, z-index使用 css 属性(例如 position、z-index)将第二个 div 放在第一个 div 上

There are 2 ways of doing that:有两种方法可以做到这一点:

1.) In the client-side: You can use the HTML5 CANVAS API. This API allows you to draw arbitrary shapes and images inside a canvas element that is rendered into the browser. 1.) 在客户端:您可以使用 HTML5 CANVAS API。此 API 允许您在呈现到浏览器中的 canvas 元素内绘制任意形状和图像。 So to solve your problem you could load an image inside the canvas and after that draw a number on top of it.因此,要解决您的问题,您可以在 canvas 中加载图像,然后在其上绘制一个数字。

2.) In the server-side: You will load the image and after that draw the number inside of it using a server-side application. 2.) 在服务器端:您将加载图像,然后使用服务器端应用程序在其中绘制数字。 Eg.例如。 an application developed using PHP, ASP.NET, Python, etc. In PHP you can use the GD library to do that.使用 PHP、ASP.NET、Python 等开发的应用程序。在 PHP 中,您可以使用 GD 库来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM