时间:2021-07-01 10:21:17 帮助过:9人阅读
这个效果?
$QR = imagecreatefrompng('http://img.bbs.csdn.net/upload/201601/04/1451892452_282416.jpg');$border = imagecreatefrompng('http://img.bbs.csdn.net/upload/201601/04/1451892077_864770.png');list($qrwidth, $qrheight) = array(imagesx($QR), imagesy($QR));list($bowidth, $boheight) = array(imagesx($border), imagesy($border));$logo_qr_width = $qrwidth / 5;$scale = $bowidth/$logo_qr_width;$logo_qr_height = $boheight/$scale;$from_width = ($qrwidth - $logo_qr_width) / 2;imagesavealpha($border,true);imagecolortransparent($border, imagecolorat($border, 1, 1));imagecopyresampled($QR, $border, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $bowidth, $boheight);ImagePng($QR);
其实直接在 $QR 上画图不是更简单?
其实直接在 $QR 上画图不是更简单?
这个效果?
$QR = imagecreatefrompng('http://img.bbs.csdn.net/upload/201601/04/1451892452_282416.jpg');$border = imagecreatefrompng('http://img.bbs.csdn.net/upload/201601/04/1451892077_864770.png');list($qrwidth, $qrheight) = array(imagesx($QR), imagesy($QR));list($bowidth, $boheight) = array(imagesx($border), imagesy($border));$logo_qr_width = $qrwidth / 5;$scale = $bowidth/$logo_qr_width;$logo_qr_height = $boheight/$scale;$from_width = ($qrwidth - $logo_qr_width) / 2;imagesavealpha($border,true);imagecolortransparent($border, imagecolorat($border, 1, 1));imagecopyresampled($QR, $border, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $bowidth, $boheight);ImagePng($QR);