npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mini-imagecrop

v2.0.12

Published

<br> --- <br> 1.mini-imagecrop 是一款利用 HTML5 canvas 为实现方式的在线裁剪图片软件。体积小巧,功能紧致。核心文件仅有 5.32kb。GZIP 压缩后味道更美 <br /> 2.支持 GIF,PNG,JPEG,WEBP 四种常用图片裁剪。具体因浏览器支持而异 <br /> 3.支持圆形裁剪 <br /> 4.支持任意宽高调整<br /> 5.支持固定尺寸导出和实际裁剪尺寸导出<br /> 6.丰富的自定义配置。<br /> 7.支持 IE10(含)以上

Downloads

63

Readme

#mini-imageCrop ##轻量级的 HTML5 图片裁剪插件

| 参数 | 说明 | 类型 | 默认值 | | ---- |-----|------|-------| | view | 必传,指定图片显示的包裹元素的选择器,可以是类名或者 ID 或者元素对象.需自行设置素宽高 | string | HTMLElement | none | | preview | 指定图片预览显示的包裹元素的选择器,可以是类名或者 ID 或者元素对象,需自行设置元素宽度,高度会与 view 元素按比例自动计算 | string | HTMLElement | none | | file | 指定 input file 元素,可以是类名或者 ID 或者元素对象 | string | HTMLInputElement | none | | onload | 图片加载完毕回调函数 | Function | none | | error | 错误回调函数,返回参数 errCode,错误代号如下: 0 - 非图片文件类型, 1 - 文件过大 , 2 - 图片加载失败 ,3 -所选区域是空的(裁剪范围内不能全黑或全白) | function | none | | size | 指定选择图片的最大字节,单位 KB | number | 1024*1024*5 == 5M | | maskWidth | 指定选取框的初始宽度,可以是 px,%,vw,vh,vmax,vmin,pt 任意合法的 CSS 单位 | string | 60% | | maskHeight | 指定选取框的初始高度,可以是 px,%,vw,vh,vmax,vmin,pt 任意合法的 CSS 单位 | string | 60% | | minWidth | 指定选取框可调整的最小宽度,传入数字即可,会自行添加 px 单位 | number | 100 | | minHeight | 指定选取框可调整的最小高度,传入数字即可,会自行添加 px 单位 | number | 100 | | outmax | 导出图片的最大边长,对于横图它是宽度,对于竖图它是高度,默认根据裁剪区域的图片真实尺度输出 | number | 0 | | keepPP | 是否保持宽高比例调整 | number | 0 | | blob | 是否导出为 blob 对象,默认导出 base64,blob 对象性能优于 base64,但 IE 浏览器不支持 Blob 对象,请根据实际情况选择 | boolean | false | | circle | 是否使用圆形裁剪,使用圆形裁剪,会在 maskWidth,maskHeight 中取小的作为园直径 | boolean | false | | isEnd | 实时预览触发时机,true 表示在 touchend 和 mouseup 触发,false 表示在 touchmove 和 mousemove 触发 | boolean | false | | quality | 导出图片质量 ,范围 0 -100 , 仅在 type == jpeg 时有效 | number | 100 | | type | 导出图片格式 ,可选值:jpeg | png | string | png |

crop 实例方法: loadImage(url) 如果需要支持在线图片裁剪,则直接调用该方法即可,需要注意的是可能会有跨域问题,请自行斟酌 cropped() 导出图片裁剪结果,当options.blob为true时,导出为promise,否则导出base64,注意判断值是否存在 reset() 选取框和预览重置到初始状态 resetAll() 调用reset()并清除选取框和图片及预览图 clear() 内存回收