I'm using a field based view to output some content that includes an ImageField. The output of the imagefield
tag contains the letter 'a' in the alt and title attributes instead of the real content entered in with the node. I found another ticket that related this issue to ImageCache and a solution is available here:
However I'm not using ImageCache, only views and I have the same problem. Comment #39 explains:
hi just want to add to #37. It only happens when the imagefield is displayed through Views, the alt and title are displayed correctly in node view. The reason is Views doesn't unserialize the data field and I couldn't find any hook to alter it. In node view, the unserialization is handled by filefield_field_load() hook.
Is this a bug or is there something else I should be doing? I don't want to have to go back and redo all my views to use node output at this point.
Thanks.
Comments
Comment #1
merlinofchaos commentedThis may ultimately actually be CCK rather than ImageField, it's hard to say, but modules that provide data to Views are 100% responsible for how that data is rendered.
Comment #2
pcave commentedThanks. I posted it to views because there was already a huge unresolved thread about this issue in ImageField.
Anyway, I traced it to a point in the function theme_imagefield_formatter_image_plain in imagefield_formatter.inc. At the point this function calls theme('imagefield_image...) on line 23 the alt and title attributes have not yet been deserialized. It can be fixed by calling $item['data'] = unserialize($item['data']); prior to the theme call, but I wonder if it needs to be fixed at a lower level. If the module's maintainers could please weigh in that would be great.
Comment #3
quicksketchThis problem has been fixed in #397578: Uncouple ImageField from FileField Custom Hooks. The problem was caused by ImageField not implementing the hook_field($op = 'sanitize'). FileField was implementing this hook correctly, but ImageField was not. Now that ImageField is just a widget it doesn't need this hook at all.
Please try out the latest CVS HEAD or development versions of both ImageField and FileField, where I'm fairly sure this problem has been fixed.
Comment #4
pebosi commentedit's back
regards
Comment #5
quicksketchThis is caused by a CCK core bug. See:
The issue in FileField: #402860: Fatal error: CCK data field not always unserialized
The issue in CCK: #407446: Per-Field to Per-Type Storage Corrupts Serialized Columns
Let's keep this one closed since it doesn't directly solve the problem.
Comment #6
TCRobbert commentedI am not sure if I should be re-opening this issue, but I figured it might help you in one way or another and hopefully helps me in the end :P
Anyways the problem returned for me after I upgraded to the latest CCK stable version, Beta 2 of both filefield and imagefield. I had it before, but the latest filefield (6.x-3.0-alpha7) back then fixed it for me. Both alt and title tags were displayed correctly.
After I upgraded, and noticed that the bug had returned, ive searched through the issue ques. By now I have installed the latest dev versions of CCK, FileField and ImageField, which included most of the patches mentioned. The ones not included I applied myself.
Checking the DB afterwards did confirm that the data was correct: a:1:{s:3:"alt";s:4:"DELL";}
At least from what I understood it should look like that.
Comment #7
quicksketchTCRobbert: Please try beta3 and post any updates to #402860: Fatal error: CCK data field not always unserialized
Comment #8
quicksketch