SimpleImage icon indicating copy to clipboard operation
SimpleImage copied to clipboard

Multiple overlay

Open Eugene-nsk opened this issue 4 years ago • 3 comments

How about add the multiple as $anchor in overlay() such as

Eugene-nsk avatar Apr 28 '21 21:04 Eugene-nsk

This should be what you need, do a test, I use it this way ... I got a piece of my code, I haven't tested it, but it should work .. $transparency = a value from 0 to 100

// ############### APPLY TEXTURE
function applyTexture($imagem, $textura, $texturaTransparencia) {
    $imgLargura = $imagem->getWidth();
    $imgAltura = $imagem->getHeight();
    list($texLargura, $teximgAltura) = getimagesize($textura);
    $x = ceil( $imgLargura / $texLargura );
    $y = ceil( $imgAltura / $teximgAltura );
    for ($linha = 0; $linha < $y; $linha++):
        for ($coluna = 0; $coluna < $x; $coluna++):
            $imagem->overlay($textura, 'top left', (100-$texturaTransparencia)/100, ($coluna*$texLargura), ($linha*$teximgAltura));
        endfor;
    endfor;
};
$image = new \claviska\SimpleImage();
$image->fromFile("../url/to/image/image.jpg");
$texture = "../url/to/texture/image.png";
applyTexture($image, $texture, $transparency);

maPer77 avatar Apr 28 '21 22:04 maPer77

I want to do a PR for this functionality as soon as I have some free time ...

maPer77 avatar Apr 28 '21 22:04 maPer77