Hi
I enabled imce field and imce module to store images as gallery. Then i created one feild for imce image.
Then i uploaded images through imce image field. suppose if i want to use any of image from imce browser, i clicked on add button. then that image will apear in respective node. Now my problem is suppose if i dont want to show any of image from imce browser, what to do. There is Remove option. but after i clicked on remove option, that image was in hide but after submitted the page, that image was not going completly. It is showing in node.

What to do if i dont want to show any of image from imce browser
plz help me out....

Comments

ufku’s picture

Project: IMCE » Imce CCK Image
Version: 5.x-1.2 » 6.x-1.0-beta1
Component: Code » User interface
Category: bug » support
Priority: Critical » Normal
balumahender’s picture

Title: how to hide the image from imce browse » how to remove the imce-image from node
Version: 6.x-1.0-beta1 » 6.x-1.x-dev
balumahender’s picture

Status: Active » Fixed

Hi All,
I fixed this issue by changing small code in java script of imceimage module.
please follow these steps
1.Open imceimage module
2.Find imceimage.js file
3.Go to this function imceimagedelete(targetField)
4. Actual function was like this
function imceimagedelete(targetField) {
var fld_name = targetField.replace(/_/, "-");
$('#edit-' + fld_name + '-0-imceimage-path').val('');
$('#edit-' + fld_name + '-0-imceimage-width').val(0);
$('#edit-' + fld_name + '-0-imceimage-height').val(0);
var img = '#img-area-' + targetField;
$(img).attr('src', 'blank.jpg');
}
But i changed a very little bit code in this function. I just added " g " for string replace
Replace this function
function imceimagedelete(targetField) {
var fld_name = targetField.replace(/_/g, "-");
$('#edit-' + fld_name + '-0-imceimage-path').val('');
$('#edit-' + fld_name + '-0-imceimage-width').val(0);
$('#edit-' + fld_name + '-0-imceimage-height').val(0);
var img = '#img-area-' + targetField;
$(img).attr('src', 'blank.jpg');
}
then Save it execute. Now Remove option(Imce image) will work in respective nodes

yang_yi_cn’s picture

Status: Fixed » Needs work

hi, can you explain the logic a little bit? I'm not very good at the regular expressions, what the 'g' makes difference ?

I'd like to commit this patch if I can understand it.

balumahender’s picture

Hi Yi Yang ,

' g ' makes global string replace in that function where as with out writing ' g ' , string will not be replaced completely. Image is deleted when string replaces with ' - '(hyphen) where string was like ' _ ' (underscore).

danepowell’s picture

Is this a duplicate? #285842: Removing an image from a CCK field

If so, please mark this issue as such and continue the discussion there. I think they already have a patch that just needs to be ported.

danepowell’s picture

Status: Needs work » Closed (duplicate)