Posted by patrickharris on December 22, 2008 at 10:40pm
12 followers
| Project: | ImageField |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
When editing the node form, some nodes (and not others mysteriously) display "a" for the Title and Alt fields, even though these fields have been stored correctly in the database. imagefield_widget_widget_process is not being given the default value to display for some reason.
Comments
#1
is this with the latest -dev release?
#2
It was against 6.3 alpha 2, but when I upgraded to the 6.3dev that didn't help things. I tried deleting the cck fields, and starting again by creating fields with different names, but the same problem still happened.
#3
I'm also seeing this. I created a content type with an ImageField that had no default Alt and Title text (and disabled the custom settings), yet when I hover over the images, 'a' appears as the title/alt text...
#4
which display format are you using for the field?
#5
In 'Display Fields' in the CCK settings, my imagefield is set to 'Image' for both teaser and full node...
#6
I have the same problem of alt and title displays "a" too.
But mine happens to all display. Not just edit forms.
Tried disabling alt and title property in CCK, still displays "a"!!
#7
Subscribing. I also have this issue, but when I edit the content type's imagefield, the Description, Alt text and Title all show my custom text as expected. When the image is saved and viewed, the title and alt texts are "a"
#8
Exactly @ UnicornSong.
Same case =(
Hope someone rectifies this issue asap.
#9
I also have this issue, I'm using all the latest modules (dev versions).
I Tried setting a custom and default alt / title tags and I get "a".
Before enabling "custom alt / title tags" some images were showing up with "s" for the alt and title tag.
#10
Ok a fix that worked for me...
I added this line (now line 18 for me)
$item['data'] = unserialize($item['data']);above this line
if (empty($item['fid']) && $field['use_default_image']) $item = $field['default_image'];so the top of my imagefield_formatter.inc file looks like this
function theme_imagefield_formatter_image_plain($element) {
// Inside a View this function may be called with null data. In that case,
// just return.
if (empty($element['#item'])) {
return '';
}
$field = content_fields($element['#field_name']);
$item = $element['#item'];
//Line added to correct title and alt appearing as "a"
$item['data'] = unserialize($item['data']);
//end addition
if (empty($item['fid']) && $field['use_default_image']) $item = $field['default_image'];
if (empty($item['filepath'])) $item = array_merge($item, field_file_load($item['fid']));
$class = 'imagefield imagefield-'. $field['field_name'];
return theme('imagefield_image', $item, $item['data']['alt'], $item['data']['title'], array('class' => $class));
}
#11
I can confirm this seems to work (though I don't understand how it works).
Attached a patch for those that don't like packaged files ;)
#12
I have problem with images displayed in my views page.
The patch seems to have solved the issue.
#13
After patching, the code I wrote to massively import node with images stop working.
I used this code to build the field structure
$node->field_img_tel = array(array(
'fid' => $file->fid,
'title' => basename($file->filename),
'filename' => $file->filename,
'filepath' => $file->filepath,
'filesize' => $file->filesize,
'mimetype' => $mime,
'description' => basename($file->filename),
'list' => 1,
'data'=>array('alt' => 'image alt',
'title' => 'image title',
),
),
);
but after patching I get this error:
warning: unserialize() expects parameter 1 to be string, array given in mysite/sites/all/modules/imagefield/imagefield_formatter.inc on line 19.Is there an error in my code?
#14
I'm also seeing this issue in views pages when I select "Image" as the format. I have tested the one line patch and it's working perfectly. Please commit!
#15
upupax, the patch adds the following code:
$item['data'] = unserialize($item['data']);Your error says:
warning: unserialize() expects parameter 1 to be string, array given...I would therefore assume that you have to change your 'data' element from an array to a string:
'data'=>array('alt' => 'image alt',
'title' => 'image title',
),
to:
'data'=>'a string (e.g. image title)',#16
I'm also getting the
warning: unserialize() expects parameter 1 to be stringerror, but I have no custom code anywhere. I'm only using a few contributed modules - views, cck, pathauto etc.
#17
Confirm.
Even creating a content with the node submit form gave the same error.
#18
Not sure that this is an Imagefield issue. I've fixed this problem by patching the filefield module - see http://drupal.org/node/363960
#19
The filefield patch seems to be working for me so far. I restored the imagefield formatter.inc file to its original state.
#20
then lets mark this as a duplicate of #363960: Data array not unserialized on the sanitize call.
#21
I updated filefield and am still getting the "a" for alt and title.
#22
I had the same problem today, then I realized the patch has not been committed to -dev version yet..
Applying the patch #11 solved the problem..
#23
updated to beta1 (imagefield/filefield)
It seems like http://drupal.org/node/397578 "Uncouple ImageField from FileField Custom Hooks" doen't solve this, or some how there are still existent problems with serialised cck fields..
as pointed in http://drupal.org/node/366434#comment-1370628 Represent title, description or alt fields in Views 2
is a filefield issue now