All Projects → RedJue → vue-crop-image-mobile

RedJue / vue-crop-image-mobile

Licence: MIT license
cut the picture for the mobile end.

Programming Languages

Vue
7211 projects

Projects that are alternatives of or similar to vue-crop-image-mobile

Cropiwa
📐 Configurable Custom Crop widget for Android
Stars: ✭ 2,185 (+13556.25%)
Mutual labels:  crop-image
react-image-crop
A responsive image cropping tool for React
Stars: ✭ 3,312 (+20600%)
Mutual labels:  crop-image
PhotoSelectAndCrop
This package integrates a UIImagePickerController into a SwiftUI app. Obtain 1) a copy of the original image, 2) a scaled and / or cropped version of it, 3) a CGFloat and 4) CGPoint. The CGFloat and CGPoint represent the scale and position of the original image used to make the processed version.
Stars: ✭ 57 (+256.25%)
Mutual labels:  crop-image
Igrphototweaks
Drag, Rotate, Scale and Crop
Stars: ✭ 212 (+1225%)
Mutual labels:  crop-image
SSImagePicker
Easy to use and configurable library to Pick an image from the Gallery or Capture an image using a Camera... 📸
Stars: ✭ 227 (+1318.75%)
Mutual labels:  crop-image
react-drop-n-crop
An opinionated implementation of react-dropzone and react-cropper
Stars: ✭ 17 (+6.25%)
Mutual labels:  crop-image
Smartcrop.py
smartcrop implementation in Python
Stars: ✭ 178 (+1012.5%)
Mutual labels:  crop-image
WAProfileImage
WAProfileImage - A library for Android for choosing and editing profile image like WhatsApp
Stars: ✭ 29 (+81.25%)
Mutual labels:  crop-image
cropimg
Another cropping jQuery plugin
Stars: ✭ 30 (+87.5%)
Mutual labels:  crop-image
AnyImageKit
A toolbox for pick/edit/capture photo or video. Written in Swift.
Stars: ✭ 580 (+3525%)
Mutual labels:  crop-image
Vue Croppie
Vue wrapper for croppie
Stars: ✭ 228 (+1325%)
Mutual labels:  crop-image
react-simple-crop
✂️ A React component library for cropping and previewing images
Stars: ✭ 19 (+18.75%)
Mutual labels:  crop-image
vue-crop
[举个例子]https://codesandbox.io/s/910ro8ym9r [演示链接(戳我直达)]http://www.wwwwxy.top/html/blg/
Stars: ✭ 38 (+137.5%)
Mutual labels:  crop-image
Croppie
A Javascript Image Cropper
Stars: ✭ 2,330 (+14462.5%)
Mutual labels:  crop-image
LyEditImageView
iOS Image Editor View
Stars: ✭ 20 (+25%)
Mutual labels:  crop-image
Faimagecropper
Image Cropper like Instagram
Stars: ✭ 188 (+1075%)
Mutual labels:  crop-image
capella
Cloud service for image storage and delivery
Stars: ✭ 116 (+625%)
Mutual labels:  crop-image
AutomaticNeuralImageCropper
Neural network making the best looking crops of images
Stars: ✭ 28 (+75%)
Mutual labels:  crop-image
ImageResize
Image resizing tool for .Net applications with ability to add text/image watermark, Supports animated images as well.
Stars: ✭ 45 (+181.25%)
Mutual labels:  crop-image
xcrop
Mobile image cropping component - Vue React 移动端裁剪组件
Stars: ✭ 27 (+68.75%)
Mutual labels:  crop-image

vue-crop-image-mobile

a mobile end cropping plug-in is based on vue.

Introduction

vue-crop-image-mobile is a lightweight mobile end clipping plug-in.it is based on Vue.js,and very easy to use. Support UMD,so not only for vue templates, but also for HTML.

the plugin also fixes IOS photo flip and is more friendly.

npm

Link: https://www.npmjs.com/package/vue-crop-image-mobile

$ npm install vue-crop-image-mobile --save

yarn

$ yarn add vue-crop-image-mobile --save

CDN

Link: https://unpkg.com/vue-crop-image-mobile@version/dist/crop-image-mobile.js (version is important)

Usage

use in Vue-template.

import Vue from 'vue'
import cropImageMobile from 'vue-crop-image-mobile'
Vue.use(cropImageMobile)

It's used in template like this.

<template>
  <div id="app">
    <div class="cropBar">
    <div class="showImage">
      <img :src="imageCorpUrl" alt="" width="100%" height="100%">
    </div>  
     <button @click="uploadImage" class="upload">上传图片</button>
     <button @click="cropImage" class="corpBtn">裁剪</button>
    </div>
    <input type="file" @change="fileCb" class="uploadInput" ref="uploadInput"> 
    <div class="cropComp">
        <crop-image-mobile 
        :imageFile="file"
        :layerZIndex="20170424"
        :layerOpacity="1"
        layerColor="#000"
        :autoCompress="false"
        :quality="0.7"
        ref="cropImageMobile" />  
    </div>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      file: "",
      imageCorpUrl: ""
    };
  },
  methods: {
    fileCb(e) {
      this.file = e.target.files[0];
    },
    cropImage() {
      this.$refs.cropImageMobile.cropImage(url => (this.imageCorpUrl = url));
    },
    uploadImage() {
      this.$refs.uploadInput.click();
    }
  }
};
</script>

use in HTML.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>vue-crop-image-mobile</title>
  </head>
  <body>
    <div id="app">
        <div class="cropBar">
            <div class="showImage">
                <img :src="imageCorpUrl" alt="" width="100%" height="100%">
            </div>
            <button @click="uploadImage" class="upload">上传图片</button>
            <button @click="cropImage" class="corpBtn">裁剪</button>
        </div>
        <input type="file" @change="fileCb" class="uploadInput" ref="uploadInput">
        <div class="cropComp">
            <crop-image-mobile 
            :image-file="file" 
            :layer-zIndex="20170424" 
            :layer-opacity="1" 
            layer-color="#000" 
            :auto-compress="false" 
            :quality="0.7"
                ref="cropImageMobile" />
        </div>
    </div>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/crop-image-mobile@version/dist/crop-image-mobile.js"></script>
</body>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                file: "",
                imageCorpUrl: ""
            };
        },
        methods: {
            fileCb(e) {
                this.file = e.target.files[0];
            },
            cropImage() {
                this.$refs.cropImageMobile.cropImage(url => (this.imageCorpUrl = url));
            },
            uploadImage() {
                this.$refs.uploadInput.click();
            }
        }
    })
</script>
</html>

example

an example is provided for reference and follow the steps below.

   git clone https://github.com/RedJue/vue-crop-image-mobile.git
   cd vue-crop-image-mobile
   npm install
   npm run dev

you can also view it on the mobile.

configuration

props type description default
image-file File the image flow null
layer-zIndex Number layer of zindex 999
layer-opacity [Number,String] layer of opacity 1
layer-color String layer of color #000
auto-compress Boolean Whether to open automatic compression. true
quality [Number,String] The compression quality,automatically compressed to false when enabled. 0.7

instance methods:

cropImage(callback(url,blob))

rendering

Online

you can scan the qr code below to preview.

online url https://redjue.cn/vue-crop-image-mobile/

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].