saveas同步保存图片缩略图

1,参考api文档

http://developer.qiniu.com/docs/v6/api/reference/fop/saveas.html

2,参考生成中用到的函数(例如用什么方法加密)

public String getAccessSign(String s) throws UnsupportedEncodingException, NoSuchAlgorithmException
     {

         byte[] bytesNewURL = s.getBytes("UTF-8");
         byte[] bytesSK = SK.getBytes("UTF-8");

         //HMACSHA1 hmac = new HMACSHA1(bytesSK);
        // byte[] digest = hmac.ComputeHash(bytesNewURL);
       //  sign = Convert.ToBase64String(digest);
       //  sign = sign.Replace('+', '-').Replace('/', '_');
      //   FinalURL = AK + ":" + sign;
     //    return FinalURL;
         SecretKeySpec signingKey = new SecretKeySpec(bytesSK, HMAC_SHA1); 
         Mac mac = Mac.getInstance(HMAC_SHA1); 

         try {
            mac.init(signingKey);
        } catch (InvalidKeyException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }  
         byte[] rawHmac = mac.doFinal(bytesNewURL); 
         sign=Base64.encodeBase64String(rawHmac);
         sign =sign.replace('+', '-');
         System.out.println(sign);
         sign =sign.replace('/', '_');
         FinalURL = AK + ":" + sign;
         return FinalURL; 

     }

你可能感兴趣的:(saveas同步保存图片缩略图)