JS压缩图片 想用JS做一个压缩文件的JSP页面!!希望能压缩到20K以内!希望各位大侠给小弟一些代码!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 压缩jsp可以用去掉空白的方法,哪些js框架都是这种压缩方式把代码压成一行或几行!示例:http://dean.edwards.name/packer/你问的是js压缩图片没有用过!DC围观一下 等比例压缩行不 <script type="text/javascript">function DrawImage(ImgD,FitWidth,FitHeight) { var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0) { if(image.width/image.height>= FitWidth/FitHeight) { if(image.width>FitWidth) { ImgD.width=FitWidth; ImgD.height=(image.height*FitWidth)/image.width; } else { ImgD.width=image.width; ImgD.height=image.height; } } else { if(image.height>FitHeight) { ImgD.height=FitHeight; ImgD.width=(image.width*FitHeight)/image.height; } else { ImgD.width=image.width; ImgD.height=image.height; } } } } </script>onload="javascript:DrawImage(this,140,125);" 没看懂,到底是准备用js来做还是jsp来做?js是做不到的. 能用JSP做也行啊!只要能在客户端把图片进行压缩,压缩后再上传到服务器上!!!!! JS对Image是无法操作的,行不通。考虑其他方法吧。 JavaScript 绘图框架 http://www.liquidx.net/plotkit/ 基础问题 新手jquery问题 关于事件绑定 怎么拿到下拉列表框里面的值 opera下js的脚本问题。ie表示无压力 用ajax级联菜单做搜索选项,点击搜索后,想保留原来所选中的下拉框选项,就像淘宝那样的分类搜索 按回车提交表单,但又不提交表单的问题! js上检验是否可以连接FTP的写法! 问个关于DWR的问题 js如何得到图片的实际尺寸 当焦点(光标)离开text文本控件的时候,事件的名字是什么? 花钱请高手搭建myeclipse+tomcat+sqlserver2000 社区左边的树状菜单是异步加载的么?搜索如何实现的啊?
示例:
http://dean.edwards.name/packer/你问的是js压缩图片没有用过!DC围观一下
<script type="text/javascript">
function DrawImage(ImgD,FitWidth,FitHeight)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>= FitWidth/FitHeight)
{
if(image.width>FitWidth)
{
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else
{
if(image.height>FitHeight)
{
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
} </script>onload="javascript:DrawImage(this,140,125);"
js是做不到的.
JavaScript 绘图框架 http://www.liquidx.net/plotkit/