PHP完全自学手册(珍藏版) 中文pdf扫描版下载
<?php
$data = isset($_GET['data']) ? $_GET['data'] : 'http://www.kuitao8.com'; $size = isset($_GET['size']) ? $_GET['size'] : '400x400'; $logo = isset($_GET['logo']) ? $_GET['logo'] : 'http://www.kuitao8.com/images/qr/logo.jpg';//中间那logo图 $png = "http://img.kuitao8.com/uploads/QR/8e57f27c52289a0fe116c8df7ea8a671.png"; $QR = imagecreatefrompng($png);//Warning: imagecreatefrompng() [function.imagecreatefrompng]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? = //$QR = imagecreatefrompng('./chart.png');//外面那QR图 if($logo !== FALSE){ $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); // Scale logo to fit in the QR Code $logo_qr_width = $QR_width/4; $scale = $logo_width/$logo_qr_width; $logo_qr_height = $logo_height/$scale; $from_width = ($QR_width-$logo_qr_width)/2; //echo $from_width;exit; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } header('Content-type: image/png'); imagepng($QR); imagedestroy($QR);
转载请注明:谷谷点程序 » php二维码中间加logo的解决方解