You are here

README.txt in Image javascript crop 5

Same filename and directory in other branches
  1. 6 README.txt
  2. 7 README.txt
Description
-----------
This module makes a javascript toolbox action available thanks to the power
of Imagecache 2. 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. Previews & multiple values not supported (yet).

Installation
------------
You need imagecache 2, imageapi and jquery_interface or jquery_ui, available at
http://drupal.org/project/jquery_interface or http://drupal.org/project/jquery_ui
After you enable the module, you can go to admin/settings/imagecrop and enable 
support for modules & fields to display a link.

Copy the page-imagecrop.tpl.php to your /themes/yourtheme directory. This way, only
needed html will be displayed for the cropping.

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
--------------
If you have the thickbox module installed, the popup isn't used but the thickbox overlay.

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_list($form) {
  $header = array(t('Thumbnail'), t('Description').' / '.t('Path'), t('Size'), t('Weight'), t('Delete'));
  
  $rows = array();
  foreach($form['images']['#value'] as $id=>$image) {
    $row = array();
    if (isset($form['imagecrop']) && module_exists('thickbox'))
    $row[] = '<img src="'.file_create_url($image->thumbpath).'" vspace="5" /><br /><a class="thickbox" href="' . url('imagecrop/showcrop/'. $id .'/0/node_images', NULL, NULL, TRUE) . '?KeepThis=true&TB_iframe=true&height=600&width=700">'. t('Javascript crop') .'</a>';
    elseif (isset($form['imagecrop']) && !module_exists('thickbox'))
    $row[] = '<img src="'.file_create_url($image->thumbpath).'" vspace="5" /><br /><a href="javascript:;" onclick="window.open(\''. url('imagecrop/showcrop/'. $id .'/0/node_images', NULL, NULL, TRUE) .'\',\'imagecrop\',\'menubar=0,resizable=1,width=700,height=650\');">'. t('Javascript crop') .'</a>';
    else
    $row[] = '<img src="'.file_create_url($image->thumbpath).'" vspace="5" />';
    $row[] = drupal_render($form['rows'][$image->id]['description']).$image->filepath;
    $row[] = array('data' => format_size($image->filesize), 'style' => 'white-space: nowrap');
    $row[] = drupal_render($form['rows'][$image->id]['weight']);
    $row[] = array('data' => drupal_render($form['rows'][$image->id]['delete']), 'align' => 'center');
    $rows[] = $row;
  }

  $output = '<fieldset><legend>'.t('Uploaded images').'</legend>';
  $output .= theme('table', $header, $rows);
  $output .= drupal_render($form);
  $output .= '</fieldset>';
  
  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

File

README.txt
View source
  1. Description
  2. -----------
  3. This module makes a javascript toolbox action available thanks to the power
  4. of Imagecache 2. 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. Previews & multiple values not supported (yet).
  18. Installation
  19. ------------
  20. You need imagecache 2, imageapi and jquery_interface or jquery_ui, available at
  21. http://drupal.org/project/jquery_interface or http://drupal.org/project/jquery_ui
  22. After you enable the module, you can go to admin/settings/imagecrop and enable
  23. support for modules & fields to display a link.
  24. Copy the page-imagecrop.tpl.php to your /themes/yourtheme directory. This way, only
  25. needed html will be displayed for the cropping.
  26. A cron task cleans up the imagecrop table clearing records from files and/or presets
  27. which do not exist anymore, so make sure cron is running.
  28. Extra Coolness
  29. --------------
  30. If you have the thickbox module installed, the popup isn't used but the thickbox overlay.
  31. Specific installation instructions for node_images module
  32. ---------------------------------------------------------
  33. You need to paste the code underneath in the template.php file of your theme.
  34. This makes sure the javascript link is available for the thumbnail.
  35. /**
  36. * Theme function override of node_images to support imagecrop module
  37. */
  38. function phptemplate_node_images_list($form) {
  39. $header = array(t('Thumbnail'), t('Description').' / '.t('Path'), t('Size'), t('Weight'), t('Delete'));
  40. $rows = array();
  41. foreach($form['images']['#value'] as $id=>$image) {
  42. $row = array();
  43. if (isset($form['imagecrop']) && module_exists('thickbox'))
  44. $row[] = '
    '. t('Javascript crop') .'';
  45. elseif (isset($form['imagecrop']) && !module_exists('thickbox'))
  46. $row[] = '
    '. t('Javascript crop') .'';
  47. else
  48. $row[] = '';
  49. $row[] = drupal_render($form['rows'][$image->id]['description']).$image->filepath;
  50. $row[] = array('data' => format_size($image->filesize), 'style' => 'white-space: nowrap');
  51. $row[] = drupal_render($form['rows'][$image->id]['weight']);
  52. $row[] = array('data' => drupal_render($form['rows'][$image->id]['delete']), 'align' => 'center');
  53. $rows[] = $row;
  54. }
  55. $output = '
    '.t('Uploaded images').'';
  56. $output .= theme('table', $header, $rows);
  57. $output .= drupal_render($form);
  58. $output .= '';
  59. return $output;
  60. }
  61. Features, support, bugs etc
  62. ---------------------------
  63. File request,bugs,patches on http://drupal.org/project/imagecrop
  64. Inspiration
  65. -----------
  66. Came from the imagefield_crop module on which I based the html and jquery
  67. with some adjustments.
  68. Author
  69. ------
  70. Kristof De Jaeger - http://drupal.org/user/107403 - http://realize.be