Code Monkey home page Code Monkey logo

imago.js's Introduction

imago.js Build Status npm version Bower version

It's a wonderful image library! With the purpose to facilitate the manipulation of images, imago.js enables you to perform trimming and resizing. Example page

install

Available on npm and bower: npm install imago-js, bower install imago.js or directly download

basic usage

// create a new imago instance
var imago = new Imago(document.getElementsByTagName('image')[0]);

// to start a edition
imago.edit();

// to save edited image
imago.save();

// to cancel current edition
imago.cancel();

// to reset image edition
imago.reset();

if the image element already has editing attributes and/or editing elements it will be rendered according to them.

<!-- image with editing attributes -->
<img src="example.jpg" data-original-width="640" data-original-height="424" data-width="640" data-height="424" data-top="0" data-left="0">

<!-- image with initial editing elements -->
<figure>
  <img src="example.jpg" data-original-width="640" data-original-height="424" data-width="640" data-height="424" data-top="0" data-left="0">
</figure>

<!-- image with all editing elements -->
<figure>
  <img src="example.jpg" data-original-width="640" data-original-height="424" data-width="640" data-height="424" data-top="0" data-left="0">
  <div class="crop__mask"></div>
  <div class="crop__wrapper">
    <img src="example.jpg">
  </div>
  <div class="crop__handlers">
    <div class="crop__move-handler"></div>
    <span class="crop__top-left-handler"></span>
    <span class="crop__top-right-handler"></span>
    <span class="crop__bottom-left-handler"></span>
    <span class="crop__bottom-right-handler"></span>
  </div>
</figure>

constructor

new Imago(imageElement);

parameters

  • imageElement: image element used by the imago constructor.

editing attributes

  • data-original-width;
  • data-original-height;
  • data-width;
  • data-height;
  • data-top;
  • data-left;

editing elements

figure
├  image
├  .crop__mask
├  .crop__wrapper
├  └  .crop__shadow
└  .crop__handler
   ├  .crop__move-handler
   ├  .crop__top-left-handler
   └  .crop__bottom-right-handler

methods

  • imago.edit();
  • imago.save();
  • imago.cancel();
  • imago.reset();

support

  • chrome: latest;
  • firefox: latest;
  • safari: latest;
  • internet explore: 9+;

contribute

Everyone can contribute! Finding bugs, creating issues, improving documentation, improving editor it self or creating components. Every contribution will be welcomed! 🎅

Fork it -> Branch it -> Test it -> Push it -> Pull Request it 💎

imago.js's People

Contributors

ericorruption avatar evandroeisinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

omissis m-basov

imago.js's Issues

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.