使用php创建椭圆 [英] Create ellipse using php
问题描述
我需要使用自定义颜色创建如下椭圆。
I need to create an ellipse like below with custom colors.
我正在使用干预图像库来实现这一点。
I'm using Intervention image library to achieve this.
我所做的是:
我为每个创建了6个不同的透明图像部分。
尝试创建一个画布,然后屏蔽其他图层,但结果不符合预期。
我只能通过这个过程为图像的第一部分着色。
What i've done is :
I've created 6 different transparent images for each section.
And trying to create a canvas and then masking other layer on it but the result is not as expected.
I'm able to color only the first section of the image through this process.
Image::configure(array('driver' => 'gd'));
$img = Image::canvas(150,104,'#000')->insert(WWW_ROOT.DS.IMAGES_URL.'test/masks/1.png');
$img->mask(WWW_ROOT.DS.IMAGES_URL.'test/masks/2.png', true);
$img->mask(WWW_ROOT.DS.IMAGES_URL.'test/masks/3.png', true);
$img->mask(WWW_ROOT.DS.IMAGES_URL.'test/masks/4.png', true);
$img->mask(WWW_ROOT.DS.IMAGES_URL.'test/masks/5.png', true);
$img->mask(WWW_ROOT.DS.IMAGES_URL.'test/masks/6.png', true);
$img->save(WWW_ROOT.DS.IMAGES_URL.'test/test.png');
echo $img->response();
我需要帮助才能创建上面的自定义颜色图像或任何其他选项来实现此目的。
I need help to create the above Custom Color image or any other options to achieve this.
推荐答案
最后我能够达到预期的效果。
Finally I was able to achieve the desired result.
我是什么完成的是:
Used this image to get polygon coordinates of each region through this jQuery library.
获取每个区域的坐标后,我使用多边形功能创建了所需的图像http://image.intervention.io/\">干预图像库。
After getting coordinates for each region I created the desired image using polygon function provided by Intervention Image Library.
感谢所有人的帮助,也许这可以帮助其他人。
Thanks to all for your help, maybe this can help someone else.
这篇关于使用php创建椭圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!