【调用参数】:
java 使用调用。 使用jdk8 自带的java.util.base64 ,下面调用参考官网上述生成签名的还是存在上述问题。
// 申请id
long appId = 1256004136;
// secretId
String secretId ="AKIDWs1vb3eBqFPJxKALxJOFqCJCsJUTo8qO";
// secretKey 保密使用*** 处理
String secretKey ="**************";
// 空间名称
String bucketName ="publish-ocr";
// 当前时间戳
long expired =1517815800;
String str = appSign( appId, secretId, secretKey, bucketName,
expired);
System.out.println(str);
【post请求方式参数】:
POST /ocr/general?appid=1256004136&bucket=publish-ocr&url=http://publish-ocr-1256004136.picgz.myqcloud.com/test.png HTTP/1.1
Host: recognition.image.myqcloud.com
Content-Length: 187
Content-Type: application/json
Authorization: q6PNrZPc7GFxG3EVzlRwDcHN07hhPTEyNTYwMDQxMzYmYj1wdWJsaXNoLW9jciZrPUFLSURXczF2YjNlQnFGUEp4S0FMeEpPRnFDSkNzSlVUbzhxTyZ0PTE1MTc4MTQ5MjQmZT0zMDM1NjMwNzI0JnI9MTU4NDk2NzkzNw==
Cache-Control: no-cache
Postman-Token: 65e25df0-3c5b-aac6-740a-b666aef64467
Query的:
(function($) {
$.textMetrics = function(el) {
var h = 0, w = 0;
var div = document.createElement('div');
document.body.appendChild(div);
$(div).css({
position: 'absolute',
left: -1000,
top: -1000,
display: 'none'
});
$(div).html($(el).html());
var styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing'];
$(styles).each(function() {
var s = this.toString();
$(div).css(s, $(el).css(s));
});
h = $(div).outerHeight();
w = $(div).outerWidth();
$(div).remove();
var ret = {
height: h,
width: w
};
return ret;
}
})(jQuery);
使用以下样式创建一个DIV风格。在JavaScript中,设置您要测量的字体大小和属性,将字符串放在DIV中,然后读取DIV的当前宽度和高度。它将伸展以适应内容,并且大小将在字符串呈现大小的几个像素内。
HTML:
<div id="Test">
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
</div>
CSS:
#Test
{
position: absolute;
visibility: hidden;
height: auto;
width: auto;
white-space: nowrap; /* Thanks to Herb Caudill comment */
}
JavaScript(片段):
var test = document.getElementById("Test");
test.style.fontSize = fontSize;
var height = (test.clientHeight + 1) + "px";
var width = (test.clientWidth + 1) + "px";