有过SAE开发的过来见见

WBOY
Release: 2016-06-13 12:21:02
Original
976 people have browsed it

有过SAE开发的过来看看

本帖最后由 lzgctgc 于 2014-12-09 09:41:03 编辑 我用QRCode写的一个二维码生成,加logo本地生成是成功的。当在SAE上二维码生成成功,后面加logo却不行,难道SAE上不支持:imagecopyresampled函数。
<br />function Build_SAEQrcode($filename = '', $text='', $size='8', $logo = false){<br />	$return = false;<br />	$level='H';<br />	$padding=1;<br />	$path =  'saestor://uploads/direwm/';<br />    $QR = $path.$filename.".png";<br />    vendor("phpqrcode.qrlib");<br />    QRcode::png($text,$QR, $level, $size,$padding);<br />    if($logo === true){<br />    	$QR = imagecreatefromstring(file_get_contents($QR));<br />    	$logocontext = imagecreatefromstring(file_get_contents('./uploads/logo.png'));<br />    	<br />    	<br />    	$QR_width = imagesx($QR);<br />    	$QR_height = imagesy($QR);<br />    	 <br />    	$logo_width = imagesx($logocontext);<br />    	$logo_height = imagesy($logocontext);<br />    	 <br />    	$logo_qr_width = $QR_width / 5;<br />    	$scale = $logo_width / $logo_qr_width;<br />    	$logo_qr_height = $logo_height / $scale;<br />    	$from_width = ($QR_width - $logo_qr_width) / 2;<br />    	$return = imagecopyresampled($QR, $logocontext, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);<br />    	header("Content-Type:image/png");<br />    	imagepng($QR, $path.$filename.".png");<br />    }else $return =  true;<br />    imagedestroy($QR);<br />    return $return;<br />}
Copy after login

------解决思路----------------------
以前用过,后来因为他不让我免费使用了,就放弃了

imagepng($QR, $path.$filename.".png");
是肯定不支持的,因为常规的文件系统不可用了。但去掉文件名($path.$filename.".png")是可以的

file_get_contents 是否还有用,没有测试过,不确定
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template