I was asked for this by a client after migrating her site from a custom CMS where images had quite long descriptive text attached. Newly uploaded images had to have very short descriptions. After verifying that there was no limitation in the DB or additional form validation I managed, using hook_form_alter and an #after_build function, to alter the description field to be a textarea, which now seems to be working fine.

This is not the ideal way to handle the problem: it would be great if the module made it easier, perfect if there were a switch in the admin form for the field.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

This issue in the ImageField queue might also be of interest: #331713: Increase maximum length of title and alt attributes.

quicksketch’s picture

Status: Active » Fixed
FileSize
620 bytes

This patch simply makes the description length a variable and sets it to the current default of 128 characters. I'd probably discourage using the description field for extensive text though, since the description defaults to being used as the link text when using the "Generic files" formatter. Instead (if you're uploading images), you should use the "Title" field provided by ImageField, which is currently set to support up to 500 characters and can easily be converted into a textarea.

drewish’s picture

hrm... can we do it here or should i open a followup to allow longer descriptions to be edited in a textarea rather than a textfield?

drewish’s picture

Status: Fixed » Active

mayhaps?

quicksketch’s picture

Using this ticket is fine. In #331713: Increase maximum length of title and alt attributes we discussed a little bit about the intended purposes for title and alt. I don't think description should really support longer strings, because the intended use of the description field matches the way that upload.module works. That is, the description is the text of the link when using the Generic Files formatter. If it had been up to me, I wouldn't have included the description field at all as an option for ImageFields, but it's there now and it's too late to change it now.

So, even though I'd like to discourage the use of the description field for really long text, I'd be fine with implementing a variable_get() to change the type, but I don't want this to have a configuration option like we've done for the title field.

quicksketch’s picture

Status: Active » Fixed
FileSize
777 bytes

Fixed with attached patch. Drewish, let me know if you think any changes are necessary.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.