Giter Site home page Giter Site logo

mharray / gwt-cropper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from w32blaster/gwt-cropper

0.0 1.0 0.0 8.45 MB

GWT widget, that allows you to select an area of a picture and get the coordinates of this selection

Home Page: http://gwt-cropper.co.uk/

Java 95.33% CSS 4.30% HTML 0.37%

gwt-cropper's Introduction

GWT Cropper logo

GWT Cropper is a widget for Google Web Toolkit, that allows you to select an area of a picture and get the coordinates of this selection. It is useful, if you want to crop a picture on the server side.

Demo

Try the working demo:

  • Simple cropper: demo
  • Cropper with preview: demo

Gwt Cropper plugin to crop an image

Get started

The plugin is very simple. In order to use it, you should follow next steps:

1. Import plugin to your project

If you use Maven, you can add this dependency to your POM:

      <dependency>
            <groupId>com.googlecode.gwt-cropper</groupId>
            <artifactId>gwt-crop</artifactId>
            <version>0.5.5</version>
      </dependency>

If you need JAR files, you can download them from the GWT-Cropper Maven Repository page. Just select any link jar, javadoc.jar either sources.jar next to the each version to download an archive you need.

2. Declare the plugin in your project

Add this line to your .gwt.xml file:

      <!-- Inherit the GWT-Cropper -->
      <inherits name='com.google.code.gwt.crop.GWTCropper'/>

3. Use it in your project

Add GWT Cropper to any panel in your code. Simple example (on Java):

	  final GWTCropper crop = new GWTCropper("url/to/your/uncropped/image.jpg");
	  crop.setAspectRatio(1); // square selection (optional)
	  panel.add(crop);

Or sample code in .ui.xml (since v. 0.5.0):

	  <ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
			 xmlns:g='urn:import:com.google.gwt.user.client.ui'
			 xmlns:my="urn:import:com.google.code.gwt.crop.client">

	  <my:GWTCropper  ui:field="cropper"
	           aspectRatio="1.5" imageURL="url/to/your/uncropped/image.jpg" />

Tablets

GWT Cropper supports tablets since v.0.4.0. Tested on the IPad (2, 3, 4, mini), several Android devices and since v.0.4.1 the widget supports also Win8 tablets (including Microsoft Surface).

Gwt Cropper plugin to crop an image, works also on tablets

Documentation

The documentation is pretty short, but in any case, please, refer to Wiki-page or JavaDoc for details.

Take a look at the TipsAndTricks Tips & tricks page to see the most common issues.

Changelog

  • 0.5.5 Small bugfixes (Pull request 26, Pull request 27)
  • 0.5.4 Corrected gathering of the selection coordinates. Pull request 24. Thanks to @thoepfner !
  • 0.5.3.1 Now you can scale whole cropper widget and the selection will be functioning accordingly Pull request 23. Thanks @enginer!
  • 0.5.2 New Constrained Cropper Preview widget was added. Thanks to @thoepfner
  • 0.5.1 The harvesting of the selection position is calibrated.
  • 0.5.0 The new Preview widget is added (issue16). Now you can declare GWT Cropper in ui.xml files with UiBuilder (issue17). Created new Wiki page [HowToUsePreviewWidget How to use Preview widget].
  • 0.4.6 The cropper is adjusted for using with GWT-Bootstrap project (issue14); bug fixes (issue11, issue12)
  • 0.4.5 Removed hardcoded minimal selection size value (issue9); StyleResource was changed to public in order to give developers an opportunity to overwrite default CSS styles (issue10, read Wiki tutorial How to apply custom styles)
  • 0.4.4 Added method setSize(int width, int height) (issue7)
  • 0.4.2, 0.4.3: Added couple of public methods to set up initial size and position for the selection (issue6, issue8)
  • 0.4.1: Resolved issues with Internet Explorer browser and Win8 tablets. Tested on IE version 7-10 and Microsoft Surface tablet. (issue4)
  • 0.4.0: Added tablet support. Tested on iPad 2,3 and a handful of Android devices. (issue1)
  • 0.3.5: Fixed bug with "sticky" edges

Contribution

Dear colleagues, GWT Cropper is an open source project, so any contribution is highly appreciated. If you wish to send me any bugfix, improvement or new feature, please create a new issue in the Issue Tracker and send the pull request. Thanks!

gwt-cropper's People

Contributors

enginer avatar thoepfner avatar w32blaster avatar

Watchers

 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.