Arkadaşlar php ile resim üstüne resim bastırmayı nasıl yapabilirim

Örnek :
<?php
header('Content-type: image/png');
$imagesDir = 'img/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
$resim = $images[array_rand($images)];


function resim_damga($resim, $damga_resmi)
{
    

$foto = imagecreatefromjpeg($resim);
    $w = imagesx($foto);
$h = imagesy($foto);
    $hedef = imagecreatetruecolor($w, $h);

    
$sag_bosluk = rand(1,99);
$alt_bosluk = rand(1,99);
imagejpeg($foto,NULL,rand(30,100));
imagedestroy($foto);
}
resim_damga($resim,"play.png");
?>
Bu kod img klasörü içindeki resimlerin üstüne play.png logosunu basıyordu ama şuan çalıştıramadım yardımcı olabilecek arkadaş var mı acaba ?



yokmu arkadaşlar bilen ?