ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
~~~ function wxposter($imgBase64){ $imageName = "wx_".date("His",time())."_".rand(1111,9999).'.png'; $urls="/uploads/wxposer/"; $qri = ROOT_PATH . 'public' . str_replace('/', DS, $urls); if (!is_dir($qri)){ mkdir($qri,0777,true); } $path = $qri.$imageName; file_put_contents($path,$imgBase64); $code_name= "wxcode_".date("His",time())."_".rand(1111,9999).'.png'; $code_url=$qri.$code_name; file_put_contents($code_url,$imgBase64); // 底图 $imgPath = ROOT_PATH . 'public' .str_replace('/', DS, '/assets/shop/')."haibao.png"; $dst = imagecreatefromstring(file_get_contents($imgPath)); $qrcode = imagecreatefromstring(file_get_contents($code_url)); // 修改尺寸 $newwidth = 176; $newheight = 176; $dst_head = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($dst_head, $qrcode, 0, 0, 0, 0, $newwidth, $newheight, 430, 430); // 合并图片 imagecopy($dst, $dst_head, 202, 430, 0, 0, 176, 176); imagepng($dst, $path); //E:\www\pplw-master\public\uploads\wxposer\ // 释放资源 imagedestroy($dst); return $urls.$imageName; } ~~~