简体   繁体   中英

Watermark opacity fading

i've been trying to make some "watermark script ?" I am french learning english so i don't even know if watermark mean something...

i use this as watermark

在此处输入图片说明

and here is the result

在此处输入图片说明

The original img is the same

Finally the code

$uploaded_img = imagecreatefrompng($nom_fichier_temp); // the background, get by a form
$img_taille["x"] = imagesx($uploaded_img);
$img_taille["y"] = imagesy($uploaded_img);
$nbr_en_x = ceil($img_taille["x"]/300);
$nbr_en_y = ceil($img_taille["y"]/300);

$Cc = imagecreatefrompng("img/Cc.png"); //Watermark  300x300
$fond_rouge = imagecolorallocate($Cc, 255, 0, 0);
imagecolortransparent($Cc, $fond_rouge); // Deleting the red BG

for ($j=0; $j < $nbr_en_y; $j++) {
    $y = floor($j*300);
    for ($i=0; $i < $nbr_en_x; $i++) {
        imagecopymerge($uploaded_img, $Cc, $i*300, $y, 0, 0, $img_taille["x"], $img_taille["y"], 10);
    }
}
imagepng($uploaded_img, '../'. $destination);

Hope it's clear enough and wish you find where i failed :s

Thanks :D

So dumb

imagecopymerge($uploaded_img, $Cc, $i*300, $y, 0, 0, 300, 300, 10);

I'll never try to code late again...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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