PHP draw image as polygon

Viewed 41

I have a problem when comes to work with pictures in PHP, I've understand everything but i don't know how to crop an image to look as my polygon shape:

// setting the image background and size
$left = imagecreatefrompng('tips_patterns/unu.png');
$left = imagecrop($left, ['x' => 0, 'y' => 0, 'width' => 56, 'height' => 130]);

//setting shape of polygon
imagepolygon($left,array(
        0,  0,
        56, 28,
        56, 130,
        0,  102
    ),4,null);

imagecopy($final_image, $left, 0, 0, 0, 0, imagesx($left), imagesy($left));

Anybody who know how to achieve the shape of picture as my pattern? Nothing to cross the pattern.

0 Answers
Related