Giter Site home page Giter Site logo

sergio-apithy / vue-core-image-upload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanthink-ued/vue-core-image-upload

0.0 1.0 0.0 2.38 MB

a vue plugin for image to crop and upload

Home Page: http://vanthink-ued.github.io/vue-core-image-upload/index.html

JavaScript 12.77% HTML 0.14% Vue 60.69% CSS 25.61% PHP 0.80%

vue-core-image-upload's Introduction

Vue-Core-Image-Upload

npm

a vue plugin for image upload and crop ( Support πŸ“± IE10+)

ζŸ₯ηœ‹ζ–‡ζ‘£

English Document

if you use vue.js(<=2.0), you should go here.Or select 1.x.x version.

Install

npm i vue-core-image-upload --save

Code Example (ES6)

<vue-core-image-upload
  :class="['btn', 'btn-primary']"
  :crop="false"
  @imageuploaded="imageuploaded"
  :data="data"
  :max-file-size="5242880"
  url="your server url" >
</vue-core-image-upload>
import VueCoreImageUpload  from 'vue-core-image-upload';

new Vue({
  el: '#app',
  components: {
    'vue-core-image-upload': VueCoreImageUpload
  },
  data: {
    src: 'http://img1.vued.vanthink.cn/vued0a233185b6027244f9d43e653227439a.png',
  },
  methods: {
     imageuploaded(res) {
      if (res.errcode == 0) {
        this.src = 'http://img1.vued.vanthink.cn/vued751d13a9cb5376b89cb6719e86f591f3.png';
      }
    }
  }
});

NUXT

import Vue from 'vue';
import VueCoreImageUpload from 'vue-core-image-upload/dist/ssr';

Vue.use( VueCoreImageUpload );

plugins: [
  { src: '~plugins/vue-core-image-upload.js', ssr: false }
]

Demo

Props

Props Data Type Example Details
url String '/crop.php' Your server api
text String 'Upload Image' The text of your uploading button
inputOfFile String Β  Β  Β  'file' Yout input[file] name
extensions String 'png,jpg,gif' Limit the image type
crop Boolean 'server' Crop image option
cropRatio String '1:1' The cropped image shape
cropBtn Object {ok:'Save','cancel':'Give Up'} The Text of cropping button text
maxFileSize Number 10485760(10M) Limit the size of the file
maxFileSize Number 10485760(10M) Limit the size of the file
multipleSize Number 5 Limit the count of the file
maxWidth Number 150 The maximum width of cropped image
maxheight Number 150 ι™εˆΆε›Ύη‰‡ηš„ζœ€ε€§ι«˜εΊ¦
inputAccept string 'image/*' / 'image/jpg,image/jpeg,image/png' the input[file] accept
compress Number 50 Set the quality of compressed image
isXhr Boolean true IF cancel ajax uploading
headers Object {auth: xxxxx} Set customed header when ajax uploading
data Object {auth: xxxxx} Set customed data when ajax posting server

Contributions

Your contributions and suggestions are welcome πŸ˜„πŸ˜„πŸ˜„πŸ’πŸ’πŸ’.

vue-core-image-upload's People

Contributors

jackpu avatar angusjiang avatar shinerising avatar vrajroham avatar mahuanhuan avatar zaguiini avatar daidi avatar slimeball avatar forest8618 avatar limdblur avatar

Watchers

Sergio Castillo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.