{"id":13671942,"url":"https://github.com/HopeStudio/cropper","last_synced_at":"2025-04-27T18:31:56.261Z","repository":{"id":82624530,"uuid":"77738495","full_name":"HopeStudio/cropper","owner":"HopeStudio","description":"一款简易的图片裁剪、压缩插件","archived":false,"fork":false,"pushed_at":"2017-01-09T13:09:16.000Z","size":266,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-11T09:44:19.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HopeStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-31T11:59:52.000Z","updated_at":"2020-09-10T18:03:18.000Z","dependencies_parsed_at":"2024-01-14T17:05:12.254Z","dependency_job_id":"242c3423-a07c-40df-8dd6-61127c1ea9cf","html_url":"https://github.com/HopeStudio/cropper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HopeStudio%2Fcropper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HopeStudio%2Fcropper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HopeStudio%2Fcropper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HopeStudio%2Fcropper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HopeStudio","download_url":"https://codeload.github.com/HopeStudio/cropper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187361,"owners_count":21549625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:22.557Z","updated_at":"2025-04-27T18:31:55.670Z","avatar_url":"https://github.com/HopeStudio.png","language":"JavaScript","readme":"# cropper\n\n一款简易的 jQuery 图片裁剪、压缩插件（仍在开发中）。\n\n[Demo](https://hopestudio.github.io/cropper/demo/)\n\n## 快速上手\n\n`$('imgSelector').cropper(options, callback)`\n\n```html\n\u003cimg class=\"target-img\" src=\"./test.png\" style=\"width: 100px\"\u003e\n```\n```javascript\nvar cropper = $('.target-img').cropper({\n        /**\n        * outputType: 数据输出类型，传递给回调函数\n        *   type: String\n        *   default: 'file'\n        */\n        outputType: 'file',\n        /**\n        * range: 图片缩扩（zoom）range bar 参数\n        */\n        range     : {\n            min : 1,\n            max : 5,\n            step: 0.05,\n            init: 1,\n            pos : 'bottom'\n        },\n        /**\n        * cropper: 裁剪框参数\n        * fixed 设为 true 则图片不可拖动\n        */\n        cropper   : {\n            minSpace: 30,\n            fixed   : false,\n            antWidth: 1\n        },\n        /**\n        * canvas: 当 outputType 为 'file' 时的图片文件输出格式与压缩率\n        */\n        canvas    : {\n            type   : 'image/jpeg',\n            quality: 0.7\n        }\n    }, function (file) {\n        /**\n        * 回调函数内 this 指向 cropper 对象\n        */\n        console.log(URL.createObjectURL(file));\n        window.open(URL.createObjectURL(file));\n    });\n```\n\n## API\n`cropper.resetPos()`\n* 重置裁剪程序\n* 重置图片位置、尺寸、裁剪框参数\n\n`cropper.setOptions(options)`\n* 随时用于配置 `cropper` 对象使用的参数\n\n`cropper.setDefaults(options)`\n* 配置全局的 `defaults` 参数\n\n`cropper.fixImg()`\n* 固定图片，禁止图片拖拽\n\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHopeStudio%2Fcropper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHopeStudio%2Fcropper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHopeStudio%2Fcropper/lists"}