That's the QR code.
Made a square and center transparent, white border picture to embed in the QR code image
But the original center black and white position is completely transparent after the synthesis, such as
How to handle this situation, the code is as follows
List ($qrwidth, $qrheight) = getimagesize ($imgs [' QRCode ']);
List ($bowidth, $boheight) = getimagesize ($imgs [' border ']);
$QR = Imagecreatefrompng ($imgs [' QRCode ']);
$border = Imagecreatefrompng ($imgs [' border ']);
$logo _qr_width = $qrwidth/5;
$scale = $logo _width/$logo _qr_width;
$logo _qr_height = $logo _height/$scale;
$from _width = ($qrwidth-$logo _qr_width)/2;
Imagesavealpha ($border, true);
Imagecopyresampled ($QR, $border, $from _width, $from _width, 0, 0, $logo _qr_width, $logo _qr_height, $bowidth, $boheight);
Header ("Content-type:image/png");
Imagepng ($QR);
Reply to discussion (solution)
This effect?
$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 _q R_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);
Isn't it easier to draw directly on $QR?
Isn't it easier to draw directly on $QR?
is really the above effect, just contact with the PHP drawing, not quite understand
This effect?
$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 _q R_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);
Praise, really is the above effect, just touch PHP drawing, there are many functions do not understand