--- imagefield_crop.install 2009-01-29 12:12:10.000000000 +0200 +++ imagefield_cropNEW.install 2009-08-26 21:47:14.000000000 +0300 @@ -19,4 +19,20 @@ function imagefield_crop_update_6000() { content_clear_type_cache(TRUE); return $ret; -} \ No newline at end of file +} + +/** + * implementation of hook_enable + * we want to make sure that this module is enabled only when not only imageapi is enabled (this module dependancies take care of + * that), but also when at least one of its toolkits (GD, imagemagick) are enabled as well. + * @see http://drupal.org/node/466948 (this function resolves it) + * + * @return void + */ +function imagefield_crop_enable() { + if (count(imageapi_get_available_toolkits()) == 0) { + drupal_set_message(t('Image Crop module requires that at least one imageapi toolkit is enabled. Please enable it in !modules and try again. Disabling Image Crop for now.', + array('!modules' => l('admin/build/modules', 'admin/build/modules'))), "error"); + module_disable(array("imagefield_crop")); + } +}