如何使用php在img中绘制一个圆圈(100px顶部和100px左侧)?
图片网址: image.jpg
我想加载img然后在它的原始内容上绘制一个圆圈
之前:

之后:

Car*_*rlG 23
// Create a image from file.
$image = imagecreatefromjpeg('imgname.jpg');
// choose a color for the ellipse
$ellipseColor = imagecolorallocate($image, 0, 0, 255);
// draw the blue ellipse
imagefilledellipse($image, 100, 100, 10, 10, $ellipseColor);
// Output the image.
header("Content-type: image/jpeg");
imagejpeg($image);
Run Code Online (Sandbox Code Playgroud)
小智 5
首先加载图像,此功能将完全取决于您的源图像,但现在我猜它是一个jpeg:
$img = imagecreatefromjpeg('image.jpg');
Run Code Online (Sandbox Code Playgroud)
然后只需在图像上创建圆圈:
imagefilledellipse($img, 100, 100, 20, 20, 0x0000FF);
Run Code Online (Sandbox Code Playgroud)
我不确定你想如何返回它,但要将它输出到浏览器,只需使用以下内容:
imagejpeg($img);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12320 次 |
| 最近记录: |