I need to create a watermark apply it on a picture and save it with a different name . The current script works pretty well but the only problem is that I need to increase the size of the "sample text" and change the background from black to white . I tried different scenarios , changed the opacity but still can't change the background color . Any help would be highly appreciated
function watermark($imag_path, $photo_id) { // Load the stamp and the photo to apply the watermark to $im = imagecreatefromjpeg("$imag_path"); echo "imag_path is $imag_path and photoid is $photo_id"; // First we create our stamp image manually from GD $stamp = imagecreatetruecolor(490, 20); //$im = imagecreatefromjpeg("$photo_id"); imagestring($stamp, 5, 20, 2, 'sample text, 0xff0000); // Set the margins for the stamp and get the height/width of the stamp image $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp); // Merge the stamp onto our photo with an opacity (transparency) of 100% imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), 100); $new_photo_id = $photo_id."sample.JPG"; // Save the image to file and free memory imagejpeg($im, "tmp/$new_photo_id"); imagedestroy($im); }