You are here

README.txt in Image javascript crop 6

Same filename and directory in other branches
  1. 5 README.txt
  2. 7 README.txt
Description
-----------
This module makes a javascript toolbox action available thanks to the power
of Imagecache. It can currently 'hook' into several modules by adding
a 'javascript crop' link on the edit forms of supported modules and/or fields. 
The popup window will display all available imagecache presets with
a javascript crop action. In your theming you can use the imagecache theme function with
a preset. The imagecache action will make a database call to choose the right crop area.

The main difference with projects like eyedrop or imagefield_crop is that it doesn't 
provide it's own widget to upload images, instead it just 'hooks' into image modules/fields.

Everyone is invited to submit patches for more module support. I might
even give some people cvs access.

Supported modules
-----------------
image : Link is underneath the thumbnail on the edit page.
node_images : Underneath the thumbnail. Read on to implement a theme override.
imagefield : On node edit form.
Image FUpload
profile pictures

Installation
------------
You need imagecache, imageapi and jquery_ui
After you enable the module, you can go to admin/settings/imagecrop and enable 
support for modules & fields to display a link.

If you use jquery update. Make sure you also have the latest version from jquery_ui.
(For example jquery update 1.3.2 needs jquery ui 1.7.3)

A cron task cleans up the imagecrop table clearing records from files and/or presets
which do not exist anymore, so make sure cron is running.

Extra Coolness
--------------
Imagecrop supports several modal modules to open your popup with.
Supported modules are:
  - thickbox
  - colorbox (make sure you included node/*/edit in the module settings)
  - modalframe
  - shadowbox (make sure you included node/*/edit in the module settings)
  
Specific installation instructions for node_images module
---------------------------------------------------------
You need to paste the code underneath in the template.php file of your theme.
This makes sure the javascript link is available for the thumbnail.

/**
 * Theme function override of node_images to support imagecrop module
 */
function phptemplate_node_images_form_list($form) {

  $is_translation_source = $form['is_translation_source']['#value'];

  $header = array();
  if ($is_translation_source) {
    $header = array('', t('Delete'), t('List'));
  }
  $header =  array_merge($header, array(t('Thumbnail'), t('Description and info'), t('Weight'), t('Size')));
  drupal_add_tabledrag('node_images_list', 'order', 'sibling', 'node_images-weight');

  foreach (element_children($form['images']) as $key) {
    if (!$form['images'][$key]['thumbnail']) continue;

    // Add class to group weight fields for drag and drop.
    $form['images'][$key]['weight']['#attributes']['class'] = 'node_images-weight';

    $info = '<div class="node_images_info">'. t('Author: !name', array('!name' => drupal_render($form['images'][$key]['author']))).'</div>';
    $info .= '<div class="node_images_info">'. t('Uploaded on: %date', array('%date' => drupal_render($form['images'][$key]['date']))).'</div>';
    $info .= '<div class="node_images_info">'. t('Path: !path', array('!path' => drupal_render($form['images'][$key]['filepath']))).'</div>';

    if (isset($form['imagecrop'])) {
      $info .= '<div class="node_images_info">'. imagecrop_linkitem($form['images'][$key]['id']['#value'], 'node_images') .'</div>';
    }

    $row = array();
    if ($is_translation_source) {
      $row[] = '';
      $row[] = drupal_render($form['images'][$key]['delete']);
      $row[] = drupal_render($form['images'][$key]['list']);
    }
    $row[] = drupal_render($form['images'][$key]['thumbnail']);
    $row[] = array('data' => drupal_render($form['images'][$key]['description']).$info, 'width' => '100%');
    $row[] = drupal_render($form['images'][$key]['weight']);
    $row[] = array('data' => drupal_render($form['images'][$key]['filesize']), 'class' => 'nowrap');
    if ($is_translation_source) {
      $rows[] = array('data' => $row, 'class' => 'draggable');
    }
    else {
      $rows[] = $row;
    }
  }

  $output = '&nbsp;';
  if (!empty($rows)) $output .= theme('table', $header, $rows, array('id' => 'node_images_list'));
  $output .= drupal_render($form['translation_warning']);
  $output .= drupal_render($form);
  return $output;

}

Features, support, bugs etc
---------------------------
File request,bugs,patches on http://drupal.org/project/imagecrop

Inspiration
-----------
Came from the imagefield_crop module on which I based the html and jquery 
with some adjustments.

Author
------
Kristof De Jaeger - http://drupal.org/user/107403 - http://realize.be
Nils Destoop - http://drupal.org/user/361625 - http://www.menhir.be

File

README.txt
View source
  1. Description
  2. -----------
  3. This module makes a javascript toolbox action available thanks to the power
  4. of Imagecache. It can currently 'hook' into several modules by adding
  5. a 'javascript crop' link on the edit forms of supported modules and/or fields.
  6. The popup window will display all available imagecache presets with
  7. a javascript crop action. In your theming you can use the imagecache theme function with
  8. a preset. The imagecache action will make a database call to choose the right crop area.
  9. The main difference with projects like eyedrop or imagefield_crop is that it doesn't
  10. provide it's own widget to upload images, instead it just 'hooks' into image modules/fields.
  11. Everyone is invited to submit patches for more module support. I might
  12. even give some people cvs access.
  13. Supported modules
  14. -----------------
  15. image : Link is underneath the thumbnail on the edit page.
  16. node_images : Underneath the thumbnail. Read on to implement a theme override.
  17. imagefield : On node edit form.
  18. Image FUpload
  19. profile pictures
  20. Installation
  21. ------------
  22. You need imagecache, imageapi and jquery_ui
  23. After you enable the module, you can go to admin/settings/imagecrop and enable
  24. support for modules & fields to display a link.
  25. If you use jquery update. Make sure you also have the latest version from jquery_ui.
  26. (For example jquery update 1.3.2 needs jquery ui 1.7.3)
  27. A cron task cleans up the imagecrop table clearing records from files and/or presets
  28. which do not exist anymore, so make sure cron is running.
  29. Extra Coolness
  30. --------------
  31. Imagecrop supports several modal modules to open your popup with.
  32. Supported modules are:
  33. - thickbox
  34. - colorbox (make sure you included node/*/edit in the module settings)
  35. - modalframe
  36. - shadowbox (make sure you included node/*/edit in the module settings)
  37. Specific installation instructions for node_images module
  38. ---------------------------------------------------------
  39. You need to paste the code underneath in the template.php file of your theme.
  40. This makes sure the javascript link is available for the thumbnail.
  41. /**
  42. * Theme function override of node_images to support imagecrop module
  43. */
  44. function phptemplate_node_images_form_list($form) {
  45. $is_translation_source = $form['is_translation_source']['#value'];
  46. $header = array();
  47. if ($is_translation_source) {
  48. $header = array('', t('Delete'), t('List'));
  49. }
  50. $header = array_merge($header, array(t('Thumbnail'), t('Description and info'), t('Weight'), t('Size')));
  51. drupal_add_tabledrag('node_images_list', 'order', 'sibling', 'node_images-weight');
  52. foreach (element_children($form['images']) as $key) {
  53. if (!$form['images'][$key]['thumbnail']) continue;
  54. // Add class to group weight fields for drag and drop.
  55. $form['images'][$key]['weight']['#attributes']['class'] = 'node_images-weight';
  56. $info = '
    '. t('Author: !name', array('!name' => drupal_render($form['images'][$key]['author']))).'
    ';
  57. $info .= '
    '. t('Uploaded on: %date', array('%date' => drupal_render($form['images'][$key]['date']))).'
    ';
  58. $info .= '
    '. t('Path: !path', array('!path' => drupal_render($form['images'][$key]['filepath']))).'
    ';
  59. if (isset($form['imagecrop'])) {
  60. $info .= '
    '. imagecrop_linkitem($form['images'][$key]['id']['#value'], 'node_images') .'
    ';
  61. }
  62. $row = array();
  63. if ($is_translation_source) {
  64. $row[] = '';
  65. $row[] = drupal_render($form['images'][$key]['delete']);
  66. $row[] = drupal_render($form['images'][$key]['list']);
  67. }
  68. $row[] = drupal_render($form['images'][$key]['thumbnail']);
  69. $row[] = array('data' => drupal_render($form['images'][$key]['description']).$info, 'width' => '100%');
  70. $row[] = drupal_render($form['images'][$key]['weight']);
  71. $row[] = array('data' => drupal_render($form['images'][$key]['filesize']), 'class' => 'nowrap');
  72. if ($is_translation_source) {
  73. $rows[] = array('data' => $row, 'class' => 'draggable');
  74. }
  75. else {
  76. $rows[] = $row;
  77. }
  78. }
  79. $output = ' ';
  80. if (!empty($rows)) $output .= theme('table', $header, $rows, array('id' => 'node_images_list'));
  81. $output .= drupal_render($form['translation_warning']);
  82. $output .= drupal_render($form);
  83. return $output;
  84. }
  85. Features, support, bugs etc
  86. ---------------------------
  87. File request,bugs,patches on http://drupal.org/project/imagecrop
  88. Inspiration
  89. -----------
  90. Came from the imagefield_crop module on which I based the html and jquery
  91. with some adjustments.
  92. Author
  93. ------
  94. Kristof De Jaeger - http://drupal.org/user/107403 - http://realize.be
  95. Nils Destoop - http://drupal.org/user/361625 - http://www.menhir.be