0

如何让上传的gif 依旧能动?
代码如下

 public static String upload(String fileName, byte[] fileBytes) {
        try {
            String imgMd5 = DigestUtils.md5Hex(fileBytes);
            // 图片保存的相对目录
            fileName =
                    FileUtils.formatFilePath(FileUtils.DEFAULT_STANDARD_FILE_DELIMITER + imgMd5 + fileName);
            if (StringUtils.startsWith(fileName, "/")){
                fileName = StringUtils.substringAfter(fileName, "/");
            }
            //
            PutPolicy putPolicy = new PutPolicy(BUCKET_NAME);
            String token = putPolicy.token(mac);

            PutExtra extra = new PutExtra();
            PutRet put = IoApi.Put(token, fileName, new ByteArrayInputStream(fileBytes), extra);
            if (!isSuccess(put)){
                throw new RuntimeException();
            }
            return FileUtils.formatFileDyncPath(fileName);
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

1 个回答

0

您好,方便提供下上传后的gif外链看看么?