| | |
| | |
|
| | |
|
| | | @Override
|
| | | public String drawInviteQrCodeNew(String url, Long uid, String portrait, String inviteCode) throws IOException {
|
| | | public String drawInviteQrCodeNew(String url, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws IOException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(url)) {
|
| | | return null;
|
| | |
| | | portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
|
| | | erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
|
| | | }
|
| | | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
|
| | | ImageUtil.inviteFriendImg(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode);
|
| | |
|
| | | ImageUtil.inviteFriendImgWhitecustom(urlInputStream, portraitInputStream, erCodeInputStream, targetPath,
|
| | | pX, pY, size, inviteCode);
|
| | | |
| | | // 删除二维码文件
|
| | | if(erCodeInputStream != null) {
|
| | | erCodeInputStream.close();
|
| | | }
|
| | | if (erCodeTempPath != null && new File(erCodeTempPath).exists()) {
|
| | | new File(erCodeTempPath).delete();
|
| | | }
|
| | | |
| | | // 上传文件相对位置
|
| | | if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
|
| | | |
| | | int index = url.lastIndexOf("/");
|
| | | String newUrl = url.substring(index + 1);
|
| | | String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
|
| | |
|
| | | String fileUrl= null;
|
| | | if (uid == null) {
|
| | | fileUrl= "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | } else {
|
| | | |
| | | fileUrl = "ercode/" + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | if (new File(erCodeTempPath).exists())
|
| | | new File(erCodeTempPath).delete();
|
| | | }
|
| | | |
| | |
|
| | | // 上传文件
|
| | | String imgUrl = COSManager.getInstance().uploadFile(new File(targetPath), fileUrl).getUrl();
|
| | | if (new File(targetPath).exists())
|
| | | new File(targetPath).delete();
|
| | | |
| | | // 删除本地缓存文件
|
| | | new File(targetPath).delete();
|
| | |
|
| | | return imgUrl;
|
| | | }
|
| | |
| | | // 开始根据 url(背景图), qrCode(二维码), portrait(头像) 生成图片
|
| | | ImageUtil.drawInviteToGreet(urlInputStream, portraitInputStream, erCodeInputStream, targetPath, inviteCode, content, date);
|
| | |
|
| | | |
| | | // 删除二维码文件
|
| | | if(erCodeInputStream != null) {
|
| | | erCodeInputStream.close();
|
| | | }
|
| | | if (erCodeTempPath != null && new File(erCodeTempPath).exists()) {
|
| | | new File(erCodeTempPath).delete();
|
| | | }
|
| | | |
| | | // 上传文件
|
| | | if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
|
| | | int index = url.lastIndexOf("/");
|
| | |
| | | // 上传文件相对位置
|
| | | String fileUrl= null;
|
| | | if (uid == null) {
|
| | | fileUrl= "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | } else {
|
| | | |
| | | fileUrl = "ercode/" + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | if (new File(erCodeTempPath).exists())
|
| | | new File(erCodeTempPath).delete();
|
| | | }
|
| | |
|
| | | // 上传
|
| | | String imgUrl = COSManager.getInstance().uploadFile(new File(targetPath), fileUrl).getUrl();
|
| | | |
| | | if (new File(targetPath).exists())
|
| | | new File(targetPath).delete();
|
| | | // 删除缓存文件
|
| | | new File(targetPath).delete();
|
| | |
|
| | | return imgUrl;
|
| | | }
|
| | | |
| | | return null;
|
| | | }
|
| | |
|