【文件属性】:
文件名称:imagescale:图像缩略图处理模块。用于指定最大宽度和最大高度的缩略图计算图像宽度和高度
文件大小:2KB
文件格式:ZIP
更新时间:2021-07-12 10:43:44
JavaScript
图像比例
图像缩略图处理模块。用于指定最大宽度和最大高度的缩略图计算图像宽度和高度
用法
将代码复制到您的项目,并作为全局变量,AMD / CMD,并不管你想要的。
imagescale(图像,maxWidth,maxHeight)
var image = new Image ( ) ;
image . src = 'xxx' ;
image . onload = function ( ) {
imagescale ( this , 128 , 64 ) ;
// Limit width and use auto height
imagescale ( this , 128 , "auto" ) ;
// Limit height and use auto width
imagescale ( this , "auto" , 64 ) ;
}
【文件预览】:
imagescale-master
----imagescale.js(2KB)
----LICENSE(1KB)
----README.md(537B)