Hi,

I enabled the description field (used by Lightbox for the caption) on the Imagefield module but I need the max size to be a little larger than 128 characters. Can someone point me to the file where this size limitation is located? I searched the imagefield and filefield module files to no avail.

Thanks

Drupal 6.8
FileField 6.x-3.0-alpha5
ImageField 6.x-3.0-alpha2

Comments

patrickharris’s picture

Have a look at imagefield_widget.inc - you could hack it, and change the '#alt_settings #type' from textfield to textarea. For a more long term solution see this thread.

jtjones23’s picture

Thanks for the pointer. I changed the textfield in imagefield_widget.inc to a textarea but that does not seem to make any difference. Any other suggestions?

      '#type' => 'textarea',
   	'#rows' => 3,
   	'#columns' => 64,
    '#title' => t('Default ALT text'),
    '#default_value' => !empty($widget['alt']) ? $widget['alt'] : '',
    '#description' => t('This value will be used for alternate text by default.'),
    '#suffix' => theme('token_help', 'file'),
  );

guillaumeduveau’s picture

There's no solution yet but here's the feature request issue : http://drupal.org/node/349944

jason ruyle’s picture

Around line 215 of filefield_widget.inc

      //'#type' => 'textfield',
      '#type' => 'textarea',
      //'#title' => t('Description'),
      '#title' => t('Caption'),

It worked for me and loads fine. In my node-slideshow.tpl.php (slideshow is my content type) I used:

print $node->field_photo['0']['data']['description'];

And now I have a nice textarea per image and a "title" called caption for my client.

I will be putting something into my utility module, but this is a short term solution (quick fix).

It stores and loads fine.

------------------------------
i do stuff

------------------------------
i do stuff

Anonymous’s picture

Just add the following to settings.php...

$conf['filefield_description_length'] = 1024;
$conf['filefield_description_type'] = 'textarea';

KhaledBlah’s picture

Thx a lot Devin! This worked perfectly!

KhaledBlah’s picture

I have noticed one problem: maxlength is not specified for textareas in HTML, so you might want to implement some JS to validate the max. length of the textarea input.

Learn more here: http://www.cs.tut.fi/~jkorpela/forms/textarea.html

netentropy’s picture

I could not get this to work but this did work


 function formsarray_init() {
    global $conf;
    $conf['filefield_description_length'] = 1024;
    $conf['filefield_description_type'] = 'textarea';
}

I guess what I would really like to know is how did you even know to look for it in the $conf variables

magendiran’s picture

Thanks Devinfoley

scalp’s picture

I couldn't get anything listed here to work for me. Also had tried to do this with a hook_form_alter, but couldn't find the maxlength in $form. Luckily the solution listed at http://viju.tvercity.net/en/weblog/drupal-6-how-change-description-textf... worked for me. Just add the following into a module:

<?php
/**
 * Changes to the filefield description field
 */
variable_set('filefield_description_length', 250);
variable_set('filefield_description_type', 'textarea');
MMusashi’s picture

Thanks a lot.

juc1’s picture

@ scalp or anyone - thanks but what does...

"Just add the following into a module:"

...mean?

Where does the snippet go?

imatsu@drupal.org.es’s picture

Muchas gracias, son las 23:00 y esto me ha salvado la noche,

Es simple, en el directorio modules/filefield editar filefield.module y agregar en la segunda línea es decir después del <?php

variable_set('filefield_description_length', 250);
variable_set('filefield_description_type', 'textarea');

MohammadMoussa-Lebanon’s picture

Thanks A alot scalp that was helpful

marleo’s picture

How to create a simple Drupal 6 module in three easy steps: http://drupal.org/node/416986

jbfelix’s picture

Tanks, but the description is in plaintext format. Is IT possible to use filtered or full html for the file description ?