您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

有过SAE开发的过来见见

2024/3/25 22:26:18发布16次查看
有过sae开发的过来看看
本帖最后由 lzgctgc 于 2014-12-09 09:41:03 编辑 我用qrcode写的一个二维码生成,加logo本地生成是成功的。当在sae上二维码生成成功,后面加logo却不行,难道sae上不支持:imagecopyresampled函数。
function build_saeqrcode($filename = '', $text='', $size='8', $logo = false){
$return = false;
$level='h';
$padding=1;
$path = 'saestor://uploads/direwm/';
$qr = $path.$filename..png;
vendor(phpqrcode.qrlib);
qrcode::png($text,$qr, $level, $size,$padding);
if($logo === true){
$qr = imagecreatefromstring(file_get_contents($qr));
$logocontext = imagecreatefromstring(file_get_contents('./uploads/logo.png'));
$qr_width = imagesx($qr);
$qr_height = imagesy($qr);
$logo_width = imagesx($logocontext);
$logo_height = imagesy($logocontext);
$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;
$return = imagecopyresampled($qr, $logocontext, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
header(content-type:image/png);
imagepng($qr, $path.$filename..png);
}else $return = true;
imagedestroy($qr);
return $return;
}
------解决思路----------------------
以前用过,后来因为他不让我免费使用了,就放弃了
imagepng($qr, $path.$filename..png);
是肯定不支持的,因为常规的文件系统不可用了。但去掉文件名($path.$filename..png)是可以的
file_get_contents 是否还有用,没有测试过,不确定
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product