I wanted to remove the epsa cropping from certain image upload cck fields when it is not nessary to crop.
I unchecked all the radio boxes in the manage fields area yet the manage image crops button stil shows up.
Is there any way to do this ?

Let me know if I can provide any info.

thanks,

Nick

CommentFileSizeAuthor
#2 epsacrop-6.x-1.3-with-path.zip241.31 KBgerson.analista

Comments

gerson.analista’s picture

I agree with naeluh this is a very important option.

gerson.analista’s picture

StatusFileSize
new241.31 KB

I did a change to implement this functionality in this module.

On file epsacrop.module
On the functiom on line 605.

function _epsacrop_get_field_actions($type_name, $field_name) {
$actions = _epsacrop_get_crop_actions();
$content_type = content_types($type_name);
$presets = $content_type['fields'][$field_name]['widget']['epsacrop_presets'];

if (!empty($presets) && is_array($presets)) {
$presets = array_flip($presets);
foreach ($actions as $key => $action) {
if (!array_key_exists($action['presetname'], $presets)) {
unset($actions[$key]);
}
}
}
// Here we gonna strip the px after height and with
$_actions = array();
foreach($actions as $key => $action) {
$_actions[$key] = array(
'presetname' => $action['presetname'],
'height' => (int) preg_replace('/[^0-9]+/', '', $action['height']),
'width' => (int) preg_replace('/[^0-9]+/', '', $action['width'])
);
}

return $_actions;
}

I change for:

function _epsacrop_get_field_actions($type_name, $field_name) {
$actions = _epsacrop_get_crop_actions();
$content_type = content_types($type_name);
$presets = $content_type['fields'][$field_name]['widget']['epsacrop_presets'];
if(!$presets['dont_show']){
if (!empty($presets) && is_array($presets)) {
$presets = array_flip($presets);
foreach ($actions as $key => $action) {
if (!array_key_exists($action['presetname'], $presets)) {
unset($actions[$key]);
}
}
}
// Here we gonna strip the px after height and with
$_actions = array();
foreach($actions as $key => $action) {
$_actions[$key] = array(
'presetname' => $action['presetname'],
'height' => (int) preg_replace('/[^0-9]+/', '', $action['height']),
'width' => (int) preg_replace('/[^0-9]+/', '', $action['width'])
);
}
}

return $_actions;
}

And on the functiom on line 635.

function epsacrop_widget_settings_alter(&$settings, $op, $widget) {
$widget_type = isset($widget['widget_type']) ? $widget['widget_type'] : $widget['type'];
// Alter only imagefied_widget
if (!stristr($widget_type, 'imagefield_widget')) {
return;
}

// Add our new options to the list of settings to be saved.
if ($op == 'save') {
$settings = array_merge($settings, array('epsacrop_presets'));
}

// Add the additional settings to the form.
$presets['dont_show']=t("Don't show.");
$presets += _epsacrop_get_crop_presets();
if ($op == 'form') {
$settings['epsacrop'] = array(
'#type' => 'fieldset',
'#title' => t('EPSA Crop'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('These options allow the user to pick imagecache presets that would be available to crop.'),
'#weight' => 15,
);
$settings['epsacrop']['epsacrop_presets'] = array(
'#title' => t('Imagecache presets'),
'#type' => 'checkboxes',
'#default_value' => (($widget['epsacrop_presets'] != NULL) ? $widget['epsacrop_presets'] : array()),
'#options' => $presets,
'#description' => t('Only presets utilising crop filter are available'),
);
}
}

I change for:

function epsacrop_widget_settings_alter(&$settings, $op, $widget) {
$widget_type = isset($widget['widget_type']) ? $widget['widget_type'] : $widget['type'];
// Alter only imagefied_widget
if (!stristr($widget_type, 'imagefield_widget')) {
return;
}

// Add our new options to the list of settings to be saved.
if ($op == 'save') {
$settings = array_merge($settings, array('epsacrop_presets'));
}

// Add the additional settings to the form.
$presets['dont_show']=t("Don't show.");
$presets += _epsacrop_get_crop_presets();

if ($op == 'form') {
$settings['epsacrop'] = array(
'#type' => 'fieldset',
'#title' => t('EPSA Crop'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#description' => t('These options allow the user to pick imagecache presets that would be available to crop.'),
'#weight' => 15,
);
$settings['epsacrop']['epsacrop_presets'] = array(
'#title' => t('Imagecache presets'),
'#type' => 'checkboxes',
'#default_value' => (($widget['epsacrop_presets'] != NULL) ? $widget['epsacrop_presets'] : array()),
'#options' => $presets,
'#description' => t('Only presets utilising crop filter are available'),
);
}
}

basically I added 3 lines in code.

yvmarques’s picture

Issue summary: View changes
Status: Active » Closed (fixed)