案例:前端图片截取功能

分布说明A:选择File本地选择的图片 B:根据需求按比例缩放图片 C:区域选择型操作

A: 选择图片

<input class="upfile" type="file" id="pictureUpload" name="pictureUpload">
<image id="SelectImage">

B: 如果选择的图片比较大,则按照需求缩放即可

function AutoResizeImage(TargetWidth, TargetHeight) {
var img = document.getElementById("SelectImage");
var IntWidth;
var IntHeight;
if (img.width > TargetWidth && img.height <= TargetHeight) {
IntWidth = TargetWidth;
IntHeight = (IntWidth * img.height) / img.width;
}
else if (img.width <= TargetWidth && img.height > TargetHeight) {
IntHeight = TargetHeight;
IntWidth = (IntHeight * img.width) / img.height;
}
else if (img.Width <= TargetWidth && img.height <= TargetHeight) {
IntHeight = img.width;
IntWidth = img.height;
}
else {
IntWidth = TargetWidth;
IntHeight = (IntWidth * img.height) / img.width;
if (IntHeight > TargetHeight)
{
IntHeight = TargetHeight;
IntWidth = (IntHeight * img.width) / img.height;
}
}
img.height = IntHeight;
img.width = IntWidth;
}

C: imgAreaSelect 作用是图片区域选择显示

例如图示:

 $(document).ready(function () {
//初始化选择图片区域的裁剪元素
$('#SelectImage').imgAreaSelect({
aspectRatio: '1:1',
handles: true,
fadeSpeed: 200,
onSelectChange: preview,
   minWidth:100,
   minHeight:100,
x1: 0,
y1: 0,
x2: 100,
y2: 100
});
});

jQuery imgAreaSelect Examples的更多相关文章

  1. 网站中集成jquery.imgareaselect实现图片的本地预览和选择截取

    imgAreaSelect 是由 Michal Wojciechowski开发的一款非常好用的jquery插件,实现了图片的截取功能.其文档和Demo也是很详尽的.大家可以到http://odynie ...

  2. 图片上传,图片剪切jquery.imgareaselect

    ---恢复内容开始--- <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  3. 圖片裁剪大頭貼功能 - ASP.NET WebForm + jQuery + imgAreaSelect

    系統操作環境: ASP.NET WebForm .NET Framework 4.0 (C#) jQuery 1.7.1 imgAreaSelect 0.9.8 目錄結構: 與之前使用ASP.NET ...

  4. Uploadify & jQuery.imgAreaSelect 插件实现图片上传裁剪

    在网站中需要一个图片上传裁剪的功能,借鉴这篇文章 Ajax+PHP+jQuery图片截图上传 的指点,找到了jquery.imgAreaSelect这个不错插件,能对图片进行自定义区域选择并给出坐标, ...

  5. JQuery.imgAreaSelect 参数说明

    imgAreaSelect 参数说明: 参数 描述 aspectRatio 设定选取区域的显示比率,如:”4:3“ autoHide 如果设置为true,当选择区域选择结束时消失,默认值为:false ...

  6. jQuery 图片剪裁插件使用之 imgAreaSelect

    插件主页:http://odyniec.net/projects/imgareaselect/ 官方网站上说明支持的浏览器:The plugin works in all major browsers ...

  7. 利用jquery的imgAreaSelect插件实现图片裁剪示例

    http://www.cnblogs.com/mizzle/archive/2011/10/13/2209891.html 将用户上传的图片进行裁剪再保存是现在web2.0应用中常常处理的工作,现在借 ...

  8. 采用jquery的imgAreaSelect样品图像裁剪示范插件实现

    将用户上传的图片进行裁剪再保存是如今web2.0应用中经常处理的工作,如今借助jquery的imgareaselect插件再配合PHP的GD库就能够轻松的实现这个在曾经来说很棘手的功能. 我们来看看它 ...

  9. 关于jQuery插件imgAreaSelect基础讲解

    关于ImgAreaSelect,  是一jQuery插件,它支持用户通过鼠标拖曳选择图片的一部分,如图片拖曳.图片编辑等~~来具体看一下 1.先下载imgAreaSelect插件 下载地址: 英文:h ...

随机推荐

  1. ubuntu svn rabbitvcs 安装

    参考链接:http://blog.csdn.net/weng_xianhu/article/details/10079179 32位系统完全按照上面链接安装没有问题,但是如果是64位系统,第六步下载资 ...

  2. 【006】【JVM——垃圾收集器总结】

     Java虚拟机学习总结文件夹 JVM--垃圾收集器总结 垃圾收集器概览 收集算法是内存回收的方法论.垃圾收集据是内存回收的详细实现.Java虚拟机规范中对垃圾收集器应该怎样实现没有规定.不同的厂 ...

  3. Android使用Custom debug keystore

    有时候须要用到第三方API的时候,须要一个key store 的SH1值,比如使用百度地图API,假设是协同开发,就须要全部Eclipse使用同一keystore. 例如以下图所看到的: 这里须要注意 ...

  4. hot-warm-architecture-in-elasticsearch-5-x

    https://www.elastic.co/blog/hot-warm-architecture-in-elasticsearch-5-x https://www.elastic.co/blog/e ...

  5. [AWS vs Azure] 云计算里AWS和Azure的探究(3)

    云计算里AWS和Azure的探究(3) ——Amazon EC2 和 Windows Azure Virtual Machine 今天我来比较一下AWS EC2和Azure VM的具体流程上的异同.以 ...

  6. C++11 类型推导auto

    在C++11之前,auto关键字用来指定存储期.在新标准中,它的功能变为类型推断.auto现在成了一个类型的占位符,通知编译器去根据初始化代码推断所声明变量的真实类型.使用auto会拖慢c++效率吗? ...

  7. vs ComboBox显示多行

    ComboBox,Drop List Type添加了多个数据,但是编译出来点下来按钮,只有一行. 惆怅 然后搜了下发现有人说: 在资源里面点向下箭头,把数据区拉长一点 然后才发现,原来资源里的Comb ...

  8. Vue右键菜单

    rightShow(item) { this.isPersoncontextMenus = true; let menu = document.getElementById("msgRigh ...

  9. Android下基于SDL的位图渲染(一)

    环境准备 安装Android开发环境(java.android-sdk.android ndk.gcc). 我使用的ndk版本是r10b/r10d,在win10/ubutu 15.04编译 下载sdl ...

  10. 【转】Android的root原理

    转自知乎:https://www.zhihu.com/question/21074979 @Kevin @张炬 作者:Kevin链接:https://www.zhihu.com/question/21 ...