Giter Club home page Giter Club logo

primefaces-imageeditor's Introduction

ImageEditor Component for PrimeFaces

Maven Central

About

This package provides a JSF (Java Server Faces) component ImageEditor as addition to the commonly used PrimeFaces widget library.

Authors: Christian Simon <[email protected]>, Christian Ott <[email protected]>
Copyright: illucIT Software GmbH
URL: www.illucit.com
License: The Apache License, Version 2.0
Current Version: 3.0.0

Screenshot

Compatibility:

ImageEditor is written for and tested with PrimeFaces 10.0 and JSF 2.3 (also backwards compatible to JSF 2.2). Due to changes in the PrimeFaces API for streamed data, the library is not compatible with earlier PrimeFaces versions without modifications.

In order to use the ImageEditor component with a specific PrimeFaces version, please see the compatibility table below:

ImageEditor Version PrimeFaces Version Required Java Version
ImageEditor 3.0.0 PrimeFaces 10.0 Java 8+
ImageEditor 2.2.0 PrimeFaces 8.0 Java 8+
ImageEditor 2.1.0 PrimeFaces 7.0 Java 8+
ImageEditor 2.0.0 PrimeFaces 6.2 Java 8+

Example

There is an example project that shows the usage of the ImageEditor components: illucIT/primefaces-imageeditor-example

Setup

The ImageEditor component can either be downloaded directly on GitHub or included via Maven.

Then just add the Maven artifact to your dependencies:

<dependencies>
	<dependency>
		<groupId>com.illucit</groupId>
		<artifactId>primefaces-imageeditor</artifactId>
		<version>${version.imageeditor}</version>
	</dependency>
<dependencies>

Usage in JSF

The library provides a taglib including the imageEditor component. In order to use the component, first declare a namespace for the taglib in your JSF source file (where your also would include the namespace for PrimeFaces):

<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
	...
	xmlns:p="http://primefaces.org/ui"
	xmlns:ie="http://www.illucit.com/jsf/imageeditor">

Then you can use the imageEditor tag in your facelet file.

<ie:imageEditor id="exampleImageEditor" widgetVar="imageEd"
	value="#{imageEditorBean.image}" initialColor="ffff00"
	initialShape="ellipse"
	fileUploadListener="#{imageEditorBean.onImageSaved}"
	labelSave="Save" labelDownload="Download"
	onsuccess="alert('Successfully saved!');">
	<f:param name="fileName" value="#{imageEditorBean.fileName}" />
</ie:imageEditor>

The following parameters are required for the imageEditor component to work correctly:

  • value: Expression of a method returning a StreamedContent object containing the image data. Every parameter child element of type <f:param /> will be attached to the image request.
    Note: As the image is requested by a normal GET request, no view scope can be used for this as the view id will not be transmitted.
  • fileUploadListener: Bean method accepting an ImageEditedEvent object. The method is called when the save button is pressed. The given object contains the binary image data.

Usage with PrimeFaces Elite versions

If you want to use the ImageEditor component with another PrimeFaces version than the one in the dependency, you can exclude the PrimeFaces dependency via maven and provide your own. This is especially useful, if you have access to the PrimeFaces Elite releases, which contain additional fixes and features, but are compatible with the main branch.

<dependency>
    <groupId>com.illucit</groupId>
    <artifactId>primefaces-imageeditor</artifactId>
    <version>${version.imageeditor}</version>
    <exclusions>
        <exclusion>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.primefaces</groupId>
    <artifactId>primefaces</artifactId>
    <version>${newer.primefaces.version}</version>
</dependency>

Disclaimer:

ImageEditor is free software and comes with NO WARRANTY!

primefaces-imageeditor's People

Contributors

metaxmx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

primefaces-imageeditor's Issues

Primefaces v6+ supporting

Hi there! I think this tool is very useful for those that use primefaces like me, but its outdated... Could it be possible to have compatibility for PrimeFaces v6.0 and newer versions?
Thanks in advantage.

any upload image size limit ?

Dear Sir,

I am trying this component and it works really great.
However, for some image I encounter upload problem.
The image file I edit is around 700K and toDataURL got approx 4M.
Just wonder is there any limits on the upload image size and any setting to increase it ?

Thx alots.

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.