Home > php教程 > php手册 > PHP基于phpqrcode生成带LOGO图像的二维码实例

PHP基于phpqrcode生成带LOGO图像的二维码实例

WBOY
Release: 2016-06-06 19:51:39
Original
1038 people have browsed it

这篇文章主要介绍了PHP基于phpqrcode生成带LOGO图像的二维码,可实现生成带logo与不带logo两种二维码的功能,非常简单实用,需要的朋友可以参考下

本文实例讲述了PHP基于phpqrcode生成带LOGO图像的二维码。分享给大家供大家参考。具体如下:

这里PHP使用phpqrcode生成带LOGO图像的二维码,使用起来很方便,代码中含 生成不带Logo的标准二维码和生成带Logo的二维码,可根据注释修改使用。

"; $logo = 'emwlogo.gif';//需要显示在二维码中的Logo图像 $QR = 'ewm.png'; if ($logo !== FALSE) { $QR = imagecreatefromstring ( file_get_contents ( $QR ) ); $logo = imagecreatefromstring ( file_get_contents ( $logo ) ); $QR_width = imagesx ( $QR ); $QR_height = imagesy ( $QR ); $logo_width = imagesx ( $logo ); $logo_height = imagesy ( $logo ); $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; imagecopyresampled ( $QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height ); } imagepng ( $QR, 'ewmlogo.png' );//带Logo二维码的文件名 ?>

希望本文所述对大家的php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template