There used to be a "description" field to go with uploaded images using the ImageField CCK module. This particular field made the ImageField module very useful as clients often provide copy to accompany multiple uploaded images within a single node. In Drupal 7, however, this "description" field is missing.

I have tried commenting the following line in the image.field.inc file in the function image_field_instance_settings_form($field, $instance):

// Remove the description option.
unset($form['description_field']);

Surprisingly, this seemed to work. However, I am concerned about the long-term ramifications of this solution, particularly when I apply updates to Drupal. I am wondering why this vital functionality was removed in the first place and what official workarounds there are for its absence.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

knalstaaf’s picture

Issue tags: +adding description, +image field

We need this field lots of times as well (comes in handy when using Views Galleriffic).

Thanks for this contribution, because that's exactly what we're looking for.

malphas’s picture

i kinda missed this feature as well, i dont wanna go back to d6 :(
subscribing...

knalstaaf’s picture

I am concerned about the long-term ramifications of this solution, particularly when I apply updates to Drupal.

Does it save the content of the description field properly?

zilverdistel’s picture

I suggest instead of removing the unset(), you put a dpm($form['description_field']) in there to find out how the form element looks like, then implement a hook_form_alter() that reimplements the form element (with a condition to see if it doesn't exists) in a custom module. This way you don't have to patch core, which is really bad practice.

TimG1’s picture

I'm trying to add this back too. It would nice if it was just enabled and then we can enable it if we choose to like the alt/title. In D6 I used the description field for image captions that were longer than the 80 char limit of alts.

I took a crack at trying to add the field via hook_form_alter() which I've used for other things. But this seems like it might have twist with the new function image_field_instance_settings_form(). I'm not sure how to go about this, it's a bit over my head.

Thanks for reading,
-Tim

TimG1’s picture

Title: Description field missing in Drupal 7. » Description text for CCK image fields missing in Drupal 7.

Just renaming the issue title to mention "image field".

maio1980’s picture

subscribing...

knalstaaf’s picture

The dev-version of CCK 6.x-3x is now shipped with multiple fieldgroups, so I think that's the easiest way to get the job done.

I wonder if this was being ported to D7.

mindfl10’s picture

Going into core and commenting the line of code that "unsets" the description field worked only partly for me. The filed now appears next to the image I have uploaded: so far so good. However I encounter two problems: number one, the text that I enter does not seem to save: field is blank whenever I navigate back to the add content form. Number two: I cannot find a description-data field to add into a view, like I used to in Drupal 6, so that even if I did get a description field in, how would I get to see and develop it? Anyone have any thoughts on this to get descriptions actually working in D7 this way?
Thanks.

mindfl10’s picture

After much trouble and much forum reading of clever solutions that I could not get to work, I was able to get the image title to display in the following way. I used the image title option and a little php in a views template.

Enable image title in image field of a content type
add in a title when uploading an image
go to views-view--field.tpl.php template, reformat to
views-view-field--field-image.tpl.php, save in theme folder.

past in the follwing php after

 print $output; 
add:

$newoutput = split ('"', $output);
 print $newoutput [7];

[7] was the number of my title field, I am guessing this number would vary.
hope it helps someone!

mindfl10’s picture

Note: while the above code does pull the title out, Drupa doesn't seem to like it too much. There's an error message that I can't make go away, so maybe this is not the solution...still looking 8-I

droplet’s picture

Title: Description text for CCK image fields missing in Drupal 7. » add Description text for image fields
Version: 7.0 » 8.x-dev
Category: support » feature

don't mind I change it into feature request.. we need it back in D8

droplet’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
1.22 KB

first patch :)

- Needs maintainer comments to make sure it will be back in D8
- Needs comment on how to display description

droplet’s picture

Just want to make a module for D7 but unluckily ..... no way to alter DB
#691932: Add hook_field_schema_alter()

now100handed’s picture

After applying the 7.7 update and re-applying the above patch the image descriptions are no longer exposed in Views "REPLACEMENT PATTERNS", they worked previously.

pacome’s picture

subscribing

pacome’s picture

It doesn't solve the issue, but I found another solution to "link" a txt area with an image field, I described it here : http://drupal.org/node/974888#comment-5039486

I used field-collection module, created a field-collection with an image-field and a long text field.
The field collection items (image + txt) can be then used in Views, like images+description : the field-collection is reacting like any other field.

It works as well with views-slideshow, and can be extended with more fields related to the image.

hope it can help

P.

jschrab’s picture

pacome, that's a good solution for new sites/adding-to-an-existing-site but I have a need to migrate from D6 to D7 and the description field was something we were relying on. It's "sorta" there it would appear. Recreating the feature totally seems like a work around instead of a fix.

Any news on progress with this fix? Is droplet's patch something that Webchick will bless?

Related:

Deep in CCK's content_migrate module, changes will have to be made to "content_migrate.filefield.inc" It *might* be as simple as adding

$record[$field['field_name'] . '_description'] = $data['description'];

...within...

    case 'image':
      // Map D6 imagefield field columns to D7 image field columns.
      if (!empty($record[$field['field_name'] . '_data']) && ($data = unserialize($record[$field['field_name'] . '_data']))) {
        $record[$field['field_name'] . '_alt'] = $data['alt'];
        $record[$field['field_name'] . '_title'] = $data['title'];
      }
      else {
        unset($record[$field['field_name'] . '_alt']);
        unset($record[$field['field_name'] . '_title']);
      }
...

...am I right?

EDIT: I think so - successfully migrated description content from D6 to D7 with droplet's patch and the following additions to "content_migrate.filefield.inc":

    case 'image':
      // Map D6 imagefield field columns to D7 image field columns.
      if (!empty($record[$field['field_name'] . '_data']) && ($data = unserialize($record[$field['field_name'] . '_data']))) {
        $record[$field['field_name'] . '_alt'] = $data['alt'];
        $record[$field['field_name'] . '_title'] = $data['title'];
        $record[$field['field_name'] . '_description'] = $data['description']; //-- NEW
      }
      else {
        unset($record[$field['field_name'] . '_alt']);
        unset($record[$field['field_name'] . '_title']);
        unset($record[$field['field_name'] . '_description']); //-- NEW
      }

... I SO have to spend the 10 minutes it would take to learn to make diff patch files myself :\

xjm’s picture

Status: Needs review » Needs work

Based on comments, this is NW.

ergophobe’s picture

In the meantime, you might be able to use Field Collection and Field Slideshow. At least Field Slideshow says you can create image captions and such using the Field Collection module (I haven't tried it myself, but my search brought me to this page and to the following pages).

http://drupal.org/project/field_slideshow

http://drupal.org/project/field_collection

jschrab’s picture

For new sites, or new content that would use slideshow modules, that would work, ergophobe. But that's not the problem here. The problem is that for those of us migrating a D6 site to the D7 schema, data is lost. The Description attribute of an image field isn't migrated in any form.

Ultimately, the message from Core devs is "Going forward, don't depend on this field". OK, I can roll with that going forward - but in the meantime I have to hack the core to support the description attribute until I have a field migration plan to something that will be supported going forward.

Migrating from D6 to D7 for anything more than a hobby-site can be a big Big BIG job!

bryancasler’s picture

I know it's not by default, but the File Entity module is going to allows files to be fieldable. This seems like a more robust solution.

http://drupal.org/project/file_entity

staycassiopeia’s picture

Ultimately, the message from Core devs is "Going forward, don't depend on this field". OK, I can roll with that going forward - but in the meantime I have to hack the core to support the description attribute until I have a field migration plan to something that will be supported going forward.

Wow, holy shit, really? That's sad.

ergophobe’s picture

Yeah, I realize that. More than you might guess. I'm nearing the end of a D6 => D7 migration with several complex data types. Little if anything came through the way I expected. I ended up having to create a new structure in D7 and then write SQL queries, run scripts and do tons of hand editing to get everything from D6 to D7. Sometimes I misunderstood how things were done in D7, borked everything and had to roll back to the last stable state and start over.

So yes, I know how hard this can be and I know those modules won't help everyone in this case (most notably, they don't get *me* where I want to be). But I figured I'd mention them. I also experimented with trying to move everything into using the Media suite of modules, but that really didn't fit my needs.

I'm going to check out the File Entity module mentioned in #22, but I'm in that same position of not wanting to hack/patch core and not necessarily wanting to throw out the Description field.

droplet’s picture

Category: feature » bug
Issue tags: +D7 upgrade path, +Needs backport to D7

I think it wouldn't backport to D7. I'm tagging it and looking for Webchick comment.

Image in D7 is also miss "Enable Display field & Files displayed by default".

tomgf’s picture

I am having the same problem migrating a website from WordPress to Drupal. WordPress has by default title, alt and two description fields for every uploaded image. I can live without one of them but I can not drop them all…

I know that one of the Drupal drawbacks is still a lack of a more advance image handling method (particularly for non-tech users) but there must be a way of overcoming this issue without waiting for Drupal 8, right…?

coredumperror’s picture

Would it be feasible to "clone" the image field in contrib space, creating a complete copy of it, and then adding custom description text fields? This would also require a clone and edit of the image widget to enable input into those new fields, and possibly other cloning work as well.

Unfortunately, I wouldn't know where to start, since the file field isn't defined as a class, so I have no idea if the concept of inheritance could even apply (I'm an OO programmer at heart).

xjm’s picture

Contrib modules can already alter the existing image field using the field API, e.g. hook_field_info_alter(). Seems like it wouldn't be to difficult to create a contrib module that simply adds these properties to the core field.

coredumperror’s picture

But what about storing these new properties in the DB? I'm not an expert module writer; is there a way to get around #691932: Add hook_field_schema_alter() ?

tomgf’s picture

Well, it should be possible to store this properties in the DB, even on another table if as it appears there's no possibility of altering the original schema.

The complex thing, as far as I see it not being an expert on module development, could be how to add this extra input fields to the proper widget, how to store the content on the DB on submit and – in my particular case – how this data interact with the Insert module when adding images to the content text area.

Jacine’s picture

Title: add Description text for image fields » Add Description text for image fields
Issue tags: +html5

I think having a description makes sense (for Drupal 8), and it would also make it possible to use <figure> with <figcaption> HTML5 elements for appropriate images, such as images in article nodes. Tagging to track this in the HTML5 Initiative.

David_Rothstein’s picture

Category: bug » feature

This is a feature request, not a bug. However, it seems like the kind of feature request that has a shot at being backported to Drupal 7 (especially if the appearance of the description in the UI is "opt in" like it is for File fields)?

I was curious why there's no description currently, so I looked through the Git history a bit. From the issue that originally added image fields to core, #560780-51: Add Image Field to image.module says the description was removed because it was never printed out anywhere in the default theming, so it would therefore be confusing to collect it. (And #560780-104: Add Image Field to image.module suggests the same thing was true for ImageField in D6...)

If we add it to the UI for core we probably have to add it to the default theming also?

David_Rothstein’s picture

@jschrab (#21):

The problem is that for those of us migrating a D6 site to the D7 schema, data is lost. The Description attribute of an image field isn't migrated in any form.

Ultimately, the message from Core devs is "Going forward, don't depend on this field".

Not really sure how that follows. Unless I'm mistaken, Drupal core is not providing an upgrade path from D6 ImageField at all. According to http://drupal.org/project/imagefield, the Drupal 7 CCK package is doing that....

So if there's a bug where data is getting lost on upgrade, it should be filed against CCK. It's not an issue for core to handle.

David_Rothstein’s picture

Component: image system » image.module
Jacine’s picture

@David Rothstein, hey thanks for doing that research.

If we add it to the UI for core we probably have to add it to the default theming also?

It doesn't fit every use case, so I'm not sure how we should do it. The figure/figcaption example is definitely not something that should be a default for images, and I'm not sure how much we really want to complicate output of image fields. But, for field_image inside nodes, it would make sense there as a default and we could use theme hook suggestions for it.

Another thing to consider is that this would be a useful "widget" or "combo" field in general. To expand on the figure/figcaption use, it's not just images that would benefit. Illustrations, diagrams, photos, code listings, etc, are all valid use cases from the spec. Accomplishing this now requires manually rendering only the content of 2 fields a node template, or using a contrib module like field_group to wrap them together (and that markup is really verbose and crappy when done that way).

It think it would be pretty cool and useful functionality to have in core, personally.

jschrab’s picture

@David Rothstein (#33)

So if there's a bug where data is getting lost on upgrade, it should be filed against CCK. It's not an issue for core to handle.

CCK ImageField provides the migration, that's very true. However, the target of the migration is the D7 core field-type of "Image". The core Image module does not have support in its schema for the "description" ( re: image_field_schema() ).

The CCK ImageField may be responsible for migrating the description data (and is not) but D7 core Image field type has no place for "description" to go in its schema for the CCK ImageField migration to use.

It seems to me to be a shared problem between CCK migration AND D7 core. Core needs a schema extension in Image and CCK ImageField migration needs to be aware of it. The patches in this thread are what I have been using to make that possible until I have the time to revise my code dependencies away from "description".

You are right though - Team CCK should also be made aware of this.

droplet’s picture

Status: Needs work » Needs review
FileSize
1.33 KB

I think my #13 patch still validated. How to embed it into Drupal can be a separated issue. We should backport immediately.

#1353030: Increase length of "alt" and "title" text for images make into CORE because #691932: Add hook_field_schema_alter() (Created in January 22, 2010 at 5:02am, 2 years ago) . we can do once more.

Only description is not enough:
Caption
--- IMG (ALT) (TITLE) ---
Description

lionheartbf’s picture

jschrab

I have the same issue,can you tell more details of hacking Drupal7 core to solution this,Thanks

jschrab’s picture

@lionheartbf

Everything I know is pretty much all in this thread/issue.

Niklas Fiekas’s picture

Status: Needs work » Needs review
Issue tags: -html5, -D7 upgrade path, -adding description, -image field, -Needs backport to D7

#37: 1067620-field_description-36.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1067620-field_description-36.patch, failed testing.

Niklas Fiekas’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +html5, +D7 upgrade path, +adding description, +image field, +Needs backport to D7

Thanks all. I just tried to apply the patch locally and noticed it needs to be rerolled. Tagging Novice to do a simple reroll / rebase.

droplet’s picture

Status: Needs work » Needs review
Issue tags: -Novice, -html5, -D7 upgrade path, -adding description, -image field, -Needs backport to D7

#37: 1067620-field_description-36.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Novice, +html5, +D7 upgrade path, +adding description, +image field, +Needs backport to D7

The last submitted patch, 1067620-field_description-36.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
FileSize
1.35 KB

Quick & Simple patch. anyone review it. Either discard this idea or move forward

Niklas Fiekas’s picture

Issue tags: -Novice

Thanks @droplet, the reroll looks good. Now we probably have to create the upgrade path. That seams to be blocked on #937442: Field type modules cannot maintain their field schema (field type schema change C(R)UD is needed). Given that, I am not sure if this is really backportable. Whether we backport it or not is also important for the name of the update hook, isn't it?

squarecandy’s picture

#45 working well for me.

Jacine’s picture

Priority: Major » Normal

Is this really major? As much as I'd love to see it in Drupal 8, I don't think that it's major. If you disagree feel free to explain and change this.

squarecandy’s picture

Count me amongst those who think this should be high priority.
Definitely missed from imagefield in D6...
Did anyone ever find an explanation about why this feature got "unset" in the first place? Seems bizarre taking useful, optional functionality and disabling it completely.

It's gonna get annoying having to apply this patch every time we update D7 core.

Perhaps we're supposed to be using "image" just for images and that's it - alt and title being actually part of the <img> and we should be looking towards field_collection or other such modules for associating other content with the images?

I guess what I'm getting at is that if this issue is going to get downgraded or dropped, some guidance on the best-practice alternative would be appreciated. Alt and Title are not always what I want to use as a caption.

deverman’s picture

Hi just ran into this thread. We extensively use the description field for image captions and we cannot have the data disappear when we upgrade from drupal 6 to drupal 7. From a user perspective this is a bug in the drupal 7 upgrade procedure and should be committed back to the drupal 7 core. Please let me know if there is anything we can help out with to make this happen.

katy5289’s picture

I needed to add an image caption to display under images in articles. So I added a field called Image Caption with type Text field. I used CSS to position the caption under the Image in the article. This worked for me to display image captions in full nodes.

Note: the image caption module didn't work for me. The image caption filter did help to display the image title attribute as a tool tip.

muranod’s picture

katy5289, could you elaborate? I'm only in the early-intermediate Drupal stage, but image captions (not just title / alt) are one of the main things I need for my site, for both standalone images and galleries. It's been holding me up for weeks.

I've had some success with field collection and flexslider, but am still trying to get things to align nicely. I also used one of the caption formatter modules, but would prefer to just have it be part of the image field.

Need this for article (ck-placed) as well as drupal - placed images in nodes, and if possible, something that would also work insdie image galleries.

Danny Englander’s picture

@muranod - I've being using the JCaption module which simply grabs the title or alt text of your image and renders it as a themable caption. The module has a lot of settings most of which I turn off but it works great. You can also specify which type / classes of images you want to have captions in the module's UI.

muranod’s picture

@highrockmedia - Thanks. I'll have a look at that this weekend, though I was hoping to have an actual long text field rather than using the title / alt fields, if possible.

muranod’s picture

I'm only 11 months into Drupal, but I find this an essential function, to have a long text field to associate with an image for use as a caption. Title and Alt just don't cut it for me.

A lot of people are telling stories visually - it just makes sense to be able to add paragraphs of text, if needed, to individual images which can then go into a gallery. Yes, it can be done with field collection, but it's not always a smooth process (depending on the gallery module or formatter used).

I have spent more time trying to achieve this than I have on any other part of my site, which is already live, minus any photo galleries. As good as Drupal is, I find the image handling to be rather anemic, especially because of the lack of a long text caption field. and what is available seems quite convoluted at times.

It looks as if this is changing, but progress in that direction seems very slow. If I had the skills ...

bambi_2’s picture

Is something happening about this issue? I´m waiting and hoping that there will be a solution soon.

ergophobe’s picture

If you don't have legacy content, then the solution I mentioned above would work, as would the Media Module as would File Entities.

On the latter method, quicksketch did a presentation at BADCamp and has posted his slides:
http://quicksketch.org/node/5744

dianacastillo’s picture

But how do you do this ? "Enable image title in image field of a content type" in drupal 7 ?

Danny Englander’s picture

Another option for this though it might be a little excessive would be to use the Field Collection Module, then you would have true one to one text field per image and any amount you want within one node. The theming possibilities are endless. I've used that module quite a bit for projects and it solves a lot of these types of issues.

@dianacastillo - yes you have to enable image title but that doesn't really get you all the way there. To use the title as caption, you'd have to use a Jquery caption module or simple code as illustrated below that grabs the title and makes it a text caption. For example you could do this in your theme's custom js file. (Or you would need to create one.)

(function ($) {
// Add drupal 7 code.
  Drupal.behaviors.miscfunctions = {
    attach:function (context, settings) {
// End drupal calls.

// Set image captions for image field.
  $(".field-type-image img").each(function (i, ele) {
    var title = this.title;
      if ($("img-caption").length == 0) {
        $(this).closest(".field-type-image .field-item").append("<span " +
          "class='img-caption'>" + this.title + "</span>");
        }
        else {
          $(this).closest(".field-type-image .field-item").append("");
        }
  });
  }}})
(jQuery);
dianacastillo’s picture

That doesn't answer my question . '"HOW" do you enabled the image title?' is what I need to know. Where is there that option?

droplet’s picture

No way, that's why we create this issue. (I meant desp)

@dianacastillo,

edit your image field and scroll down
" Enable Title field "

ace11’s picture

After applying patch #45 to Drupal 7 and adding node with image where is Image description field I'm getting error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_image_description' in 'field list': INSERT INTO {field_data_field_image} (entity_type, entity_id, revision_id, bundle, delta, language, field_image_fid, field_image_alt, field_image_description, field_image_title, field_image_width, field_image_height) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 39 [:db_insert_placeholder_2] => 39 [:db_insert_placeholder_3] => referenssi [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 45 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => This is image [:db_insert_placeholder_9] => [:db_insert_placeholder_10] => 1632 [:db_insert_placeholder_11] => 1224 ) in field_sql_storage_field_storage_write() (line 448 of /home/xx/modules/field/modules/field_sql_storage/field_sql_storage.module).

dianacastillo’s picture

THANK YOU!! I had been waiting for three days for that answer. I went to manager my content type, edited the image and saw
admin/structure/types/manage/slider-content/fields/field_image

Enable Title field.

z3cka’s picture

In order for this patch to work on existing sites, you will have to manually add a couple fields to a couple tables in the database. You can do with with 2 simple MySQL commands or with a tool like phpMyAdmin (assuming you are using MySQL), if you prefer clicking (like I do sometimes).

Like your error says: 'field_image_description' column (or field) is not found in your 'field_data_field_image' table... so, fire up mysql and add the missing column like this:

ALTER TABLE `field_data_field_image` ADD `field_image_description` TEXT NULL

At this point if you try to upload an image a save the node it will give you a similar error but for a different table. So, run this mysql command:

ALTER TABLE `field_revision_field_image` ADD `field_image_description` TEXT NULL

Now the patch should work as expected. Don't forget to configure your image fields to include the description on the form.

The reason you can just add this patch and have it add the tables for you is because the patch modifies the .install file of the image module. .install files are only executed when a module is enabled. So, in theory another way might be to disable the image module (be sure to uninstall as well) and re-enable it to have these table recreated for you; But, I have not tested this approach.

tyler.frankenstein’s picture

This issue inspired this module for D7:

http://drupal.org/project/image_field_caption

drupal_newb’s picture

Thank you so much for this!!! It makes using ad_gallery module on drupal 7 so much better!

mgifford’s picture

Issue tags: -html5, -D7 upgrade path, -adding description, -image field, -Needs backport to D7

#45: 1067620-image-desp-37.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +html5, +D7 upgrade path, +adding description, +image field, +Needs backport to D7

The last submitted patch, 1067620-image-desp-37.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

Just posting a related issue here about longdesc - #1971222: Incorporate longdesc into image support

Also, it's really worth looking more at Jacine's comment in #31 & #35. She disagreed with the default use of figcaption, but it could be a nice optional checbox to use figcaption for added descriptions:
http://www.w3.org/wiki/HTML/Elements/figcaption
http://caniuse.com/#search=figcaption
http://html5doctor.com/the-figure-figcaption-elements/
http://www.techrepublic.com/blog/webmaster/html5-figure-and-figure-capti...

vinod.honey’s picture

Title: Add Description text for image fields » How to add text in image field in content type
Version: 8.x-dev » 7.20
Category: feature » support

Hi,

How to add text in image field in content type.

I need to add multiple banners with different images with different text in basic page i.e after adding image field in basic page content type ...how to add text in images.

Thanks in advance.

Thanks,
Vin

droplet’s picture

Title: How to add text in image field in content type » Add Description text for image fields
Version: 7.20 » 8.x-dev
Category: support » feature

@vinod.honey,

This is not a support issue thread, Please open a new one for your problem, Thanks.

mgifford’s picture

Related issue #1971222: Incorporate longdesc into image support

figcaption has great browser support. I think we should make it available.

ressa’s picture

Thanks @jschrab! Your post (#18) hinted me in the right direction, and helped me map a D6 Description image field to a D7 Alt image field, so I could re-import it. It doesn't seem logical to me that the '_alt' and 'description' have to be be swapped, but it works.

Insert in cck/modules/content_migrate/modulescontent_migrate.filefield.inc - line 213:

if (!empty($record[$field['field_name'] . '_data']) && ($data = unserialize($record[$field['field_name'] . '_data']))) {
  $record[$field['field_name'] . '_alt'] = $data['alt'];
  $record[$field['field_name'] . '_title'] = $data['title'];
  $record[$field['field_name'] . '_alt'] = $data['description']; // NEW: map D6 description field to D7 alt field
}
ergophobe’s picture

Ressa - you're assigning to $record[$field['field_name'] . '_alt'] twice. You're just throwing away the $data['alt'] from the first assignment, so you don't need to do that. Doesn't really hurt anything, but it makes it harder to unravel the code later.

ressa’s picture

@ergophobe: I know. My Alt and Title image fields are empty. I only have content in the image Description field, and it's a one off for upgrading the site from Drupal 6 to Drupal 7. But probably good to point out to others who do have content in several of the three fields, Alt, Title and Description.

wavesailor’s picture

Just busy with my first D6 to D7 upgrade. I'm also using the D6 Image description field as a caption.
I've read through this thread but still could not find a solution? Or did I miss it?

jschrab’s picture

@wavesailor

Take a look at my post #18:
https://drupal.org/comment/5117998#comment-5117998

And @droplet's patch in #13:
https://drupal.org/comment/4700458#comment-4700458

You will have to create the 'description' field in the right table yourself for this to work.

Once you have this in place and complete your migration from 6 to 7, I really recommend migrating away from 'Description' as dependency. My change patches Drupal core and that's not really a good ongoing option for any site.

mgifford’s picture

Figure/Figcaption is already being used in Core:
core/modules/filter/templates/filter-caption.html.twig

Would be good to extend that.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Status: Needs review » Needs work

Patch no longer applies.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

JayKandari’s picture

Interesting!! Subscribing!!. :)

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

aiphes’s picture

Suscribing too. Because I'm migrating CCK imagefield and I can't use the description option in the Drupal 8 target.So I put it in the Title field.

gagarine’s picture

Version: 8.6.x-dev » 9.x-dev
xjm’s picture

Version: 9.x-dev » 8.8.x-dev

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

yabikami’s picture

Issue tags: -image field +image field

This is very important feature. In CKEditor is it a success but the for the Media Entity nothing.... responsive_image or image should have a Figcaption tag with a caption from the image field ... if you add a custom field, its rendered out of the image field.

yabikami’s picture

Priority: Normal » Major
Issue tags: -image field +image field

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mgifford’s picture

Charles Belov’s picture

Issue tags: -

For clarification, are we talking about a caption or something else? I understand that captions (intended to be seen or heard by all, whether or not they can see the image), alternative text (intended to be seen or heard only by people who cannot see the image), and title text (intended to be seen on hover, but hover is difficult on mobile, and we're trying to be mobile friendly) are different things, but is description a fourth thing, that is intended to be seen or heard by content maintainers? Or is it something else?,