I have imceimage.module,v the default of this module is to create a table for the field i want to create as below:

desc content_field_slideshow_image;
| Field                                   | Type             | Null | Key | Default | Extra |
| vid                                     | int(10) unsigned | NO   | PRI | 0       |       |
| nid                                     | int(10) unsigned | NO   | MUL | 0       |       |
| delta                                   | int(10) unsigned | NO   | PRI | 0       |       |
| field_slideshow_image_imceimage_path    | char(255)        | YES  |     |         |       |
| field_slideshow_image_imceimage_width   | int(11)          | NO   |     | 0       |       |
| field_slideshow_image_imceimage_height  | int(11)          | NO   |     | 0       |       |
| field_slideshow_image_imceimage_alt     | text             | YES  |     | NULL    |       |

and i want to add new field for seo_alt

| field_slideshow_image_imceimage_seo_alt | varchar(255)     | YES  |     | NULL    |       |

I have doen this:
1- i have altered the table alter table content_field_slideshow_image add field_slideshow_image_imceimage_seo_alt varchar(255);
2- added 'imceimage_seo_alt' => array('type' => 'varchar', 'length' => 255)); in imceimage_field_settings hook
3-changed #columns in imceimage_elements hook to be '#columns' => array('imceimage_path','imceimage_width','imceimage_height','imceimage_alt','imceimage_seo_alt'),
4- added $element['#value']['imceimage_seo_alt'], to $element['imce_view'] in imceimage_process hook
but now when i edit a slideshow and add the imceimage_seo_alt, it wouldn't be saved in the database :(... what shall i do to add this customized field??
Thanks for your help


You have taken the wrong approach. It's not as simple thing to do as you would like.

What's needed depends on your Drupal version 6 or 7. The columns in the table for the field is created though the field definition that defines which columns are needed. It's not possible to alter this without hacking the module that provides the field. This is not the approach you want to take.

Instead you need to create your own version of the field definition. You should be able to copy most of the code and alter the bits needed for the table definition. Only field or cck knows that the table contains the column for SEO it will also save and load values for that column. If you are not familiar with CCK/Fields it might take a little while to get things working. Also a down side is that you most likely will create your own version of the image field that you will have to maintain.

An alternate solution is to not store the values in the field table, but create your own table and handle saving and loading the data yourself. If you don't need integration with Views, this would probably end up as a cleaner solution.


I have managed to solve my problem and to make life easier for anyone needs to do this, the above steps in my questions are correct 100%.
now to accomplish the process you have to do the following steps:

  1. in mysql: rename table content_field_slideshow_image to content_field_slideshow_image_org
  2. in drupal: go to /admin/content/node-type/slideshow here 'slideshow' is my content type, and delete the imce image field
  3. again in drupal: create new imce image with the same configuration of the old item
  4. now in mysql, you will find that drupal has created a table content_field_slideshow_image for you
  5. in mysql
    1. drop table content_field_slideshow_image;
    2. rename table content_field_slideshow_image_org to content_field_slideshow_image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.