The crop window

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Crop Entity allows you to create a context specific crop of an image. When you crop an image from e.g. a node form, a crop entity will be created and a relation from the node to the crop will be registered. Thereby you can safely reuse images from your media library and crop them specific to the content at hand. It creates a new image in the file system that will replace the original image when rendering the referencing entity.

To use the module, just install it and the known supported widgets will be processed by Crop Entity and the widget will be modified. Use the available
hooks to register new ratios and/or register/unregister supported widgets.

The file type 'crop' is a fieldable entity, so you can add other fields to the
entity and make the editable by hooking into the crop form. This could be a
caption field that should be changeable for each crop.

You can (at the moment at least) only make one crop per image per referencing entity.

Why another crop module

There are fine crop modules out there, why make another? This started out as an extension to Manual Crop that was built into a project I was working on.
However, the data model and behavior needed to support the crop per instance instead of pr. image required so much modification that backwards compatibility would be a mess.

Requirements

You need to include imgareaselect in your libraries folder (in a folder called jquery.imgareaselect) http://odyniec.net/projects/imgareaselect/

  • ctools
  • features
  • file_entity
  • jquery_update >=2.0
  • libraries >=2.1
  • xautoload
  • crop_entity_file_type (included)

Drupal 8

It seems that exciting things are happening with Crop API. It could very well be at the core of a Drupal 8 version. There is no particular schedule for a D8 version at the time being.

Known problems / Todo

Currently the module could use a bit more configuration options and easier alteration of the widget.
Todo
----

  • Customizeable settings per field instance.
  • Lazyload the preview. When used with multiupload/media multiselect a lot of requests can be spared by not loading the image until the dialog disappears.
  • Better cleanup. If either the original image or the referencing entity
    disappears, the crop should be removed.
  • Get rid of Features dependency. The crop entity bundle should just be invoked.
  • by the install hook in the main module. The Features solution was convenient
    and fast for getting the module off the ramp.

  • Make the crop an extra field/property to make it indexable and available in views.
  • More object oriented utility classes. Right now they are mainly wrappers.

Credits

This module was developed for Danish Broadcast Corporation (DR) by Peytz & Co.

Props goes out to meghait and tss for great feedback and suggestions during development of the module.

See the readme for more information.

Supporting organizations: 

Project information

  • Module categories: Media
  • Created by kristougher on , updated