I have created a content type with an Imagefield. It works without a problem but I did suddenly notice something strange. When I view the full node the alt and title properties are empty when viewing the source. When viewing the thumbnail (created with Imagecache) in a list created with views, both alt and title have a value of "a". Also when viewed in lightbox2 the description just says a.
Here's a list of all the modules I used for the setup I currently have (I do have more modules installed but I don't think they're used for what I'm doing):
Content Construction Kit (CCK) 6.x-2.0-rc6
ImageCache 6.x-1.0-alpha2
ImageField 6.x-3.0-alpha1
Lightbox2 6.x-1.x-dev (2008-Aug-20)
View Reference 6.x-1.2
Views 6.x-2.0-rc1
I hope this is enough information. If not please let me know and I'll provide more.
Thanks in advance!
Comment | File | Size | Author |
---|---|---|---|
#52 | filefield_views_unserialize.patch | 1.34 KB | quicksketch |
#32 | alt-title-fix-299329-32.patch | 788 bytes | ComputerWolf |
Comments
Comment #1
mackh CreditAttribution: mackh commentedyup yup - same behavior here on 6rc3
Comment #2
steve_initsix CreditAttribution: steve_initsix commentedI have a similar issue on alpha2 - alt and title dont appear until you have attempted to upload, and even if you filled in description in the first place, that appears not to be saved when you view the node or re-edit it.
if you re-edit and then fill in the text fields, then click save (or upload with an empty replacement file) they still dont appear to take - will do more investigation when i have some time.
btw, fields are set to unlimited, will invesitagte if behaviour reproduced with single/numbered image fields.
Comment #3
Manuel Garcia CreditAttribution: Manuel Garcia commentedconfirmed! - also seeing this issue on 6rc3
Comment #4
ComputerWolf CreditAttribution: ComputerWolf commentedIt seems that the issue occurs in imagecache.module when it attempts to get the data from the image but it is still serialized.
Right above these lines:
put this:
That should alleviate the "a" problem.
Comment #5
ComputerWolf CreditAttribution: ComputerWolf commentedSorry for another post, but since this seems to be an imagecache problem, i'm gonna move the issue.
Comment #6
libeco CreditAttribution: libeco commentedI tried adding that to line 591 of imagecache.module in ImageCache version 6.x-1.0-alpha2. I cleared the cache, flushed ImageCache preset (don't know what it does, but it thought it might work). I than tried in both Maxthon (IE7) and firefox but didn't see any difference.
Thanks in advance!
Comment #7
Manuel Garcia CreditAttribution: Manuel Garcia commentedI tried what computerwolf suggested, added the line
$item['data'] = unserialize($item['data']);
above these twoAnd it did solve the problem, no longer do i see a as title for the image, but the title i put in the corresponding field.
Many thanks
Comment #8
Manuel Garcia CreditAttribution: Manuel Garcia commentedOK It seems I spoke too fast, after I logged out, I got this error:
warning: unserialize() expects parameter 1 to be string, array given in /opt/lampp/htdocs/asokhoah/sites/all/modules/imagecache/imagecache.module on line 592.
So I went ahead and changed the line suggested to these:
This fixes the error, however, the image title gets this: �
So I guess this isn't the solution, not a developer myself though, so I don't know what could be it :S
Comment #9
ComputerWolf CreditAttribution: ComputerWolf commentedWell, the code you have there definitely won't solve the issue since $item['data'] is probably still serialized when you try to do that. What happens if you try something like this?
That way it makes sure that the data you are trying to feed to the unserialize function is actually a string. Let me know what happens.
Comment #10
Manuel Garcia CreditAttribution: Manuel Garcia commentedOK, I guess that proves that I have no clue what "serialized" actually means heheh :)
I tried your code ComputerWolf, placed it just before
*update* I had pasted the wrong code below :s
and as far as i can tell, it does work this time. I cleared the cache several times, logged out etc, and both alt and title are set properly... so I think this time it does the trick, can someone else test it also please ?
Many thanks!
Comment #11
libeco CreditAttribution: libeco commentedIt still doesn't wok for me. I tried emptying the cache once again. Also tried adding a new image, but the problem remains. Is there anything else I have to do after adding those lines (without the PHP opening and closing tags I assume)?
Thanks!
Comment #12
steve_initsix CreditAttribution: steve_initsix commentedSame Here. Code applied, cache emptied, same issue on upload, or existing pics. Using unlimited fields, with and without lightbox, same behaviour. The description doesnt even make it past the ajax upload, it dissapears when you do this, which may mean the data isnt being posted in the first place. Will find out
Comment #13
ComputerWolf CreditAttribution: ComputerWolf commentedFor the people who have added my code and it still doesn't work, I want to make sure you have the correct code since what is posted above is a little confusing. Make sure your code looks like this:
If that code doesn't work, it would be helpful to know what your $item['data'] actually contains. Just for a little test to find out (and this will modify your pages temporarily), then place this code above those lines and above any modifications you may have already made.
After that is in place, navigate to a page that is not displaying images correctly, it should output the contents of $item['data'] for each image on the page in a status box. Now post that back here so we can take a look at it, and feel free to remove that line from your code so your pages do not display the message anymore.
Comment #14
B.P.B CreditAttribution: B.P.B commentedMy "a" problem is finally solved. Thank you ComputerWolf!!!
Comment #15
libeco CreditAttribution: libeco commentedMy lines of code looked the same.
I added that drupal_set_message right above those lines. Now it looks like this:
Nothing is displayed however; not in Maxthon (IE7), Opera or firefox...
Thanks!
Comment #16
ComputerWolf CreditAttribution: ComputerWolf commentedlibeco, it sounds to me then that your problem is even deeper than I expected. What message is displayed if you change
drupal_set_message(print_r($item['data'], 1));
todrupal_set_message(print_r($item, 1));
?Comment #17
libeco CreditAttribution: libeco commentedStill no message (or status box). I also tried these without any luck:
drupal_set_message(print($item);
print_r($item, 1);
print $item;
print($item);
Thanks!
Comment #18
ComputerWolf CreditAttribution: ComputerWolf commentedI don't know if you have tried the latest lightbox2 dev or not, but they included a fix for the 'a' issue which is exactly the same as my original fix. I am just wondering if you upgrade to the latest dev of lightbox2 if the issue is fixed there or not. Depending on if their fix works for you or not, it may help figure out your problem with imagecache.
Comment #19
Manuel Garcia CreditAttribution: Manuel Garcia commentedthe patch suggested for the lightbox2 bug mentioned above worked fine in my case, (lightbox2 6.x-1.x-dev).
It is true its a similar issue, read the patch and see :) here is the interesting part:
The fix suggested above by computerwolf stil is working on our site, dont know what you are doing wrong libeco - sorry :S
Comment #20
libeco CreditAttribution: libeco commentedI just downloaded and upgraded lightboxv2 and indeed the a problem in lightbox2 is solved. I see the title of the image there.
The alt and title in the source code (of the node with the full image in it) are still empty though...
Thanks!
Comment #21
gorbeia CreditAttribution: gorbeia commentedIf you see them empty maybe it is related to #306965: alt and title values always empty on nodes (non-Views)
Comment #22
libeco CreditAttribution: libeco commentedAhhhhhhhhhhhh! Yes, that's it! Now it is displaying correctly! Thanks for mentioning!
Comment #23
no2e CreditAttribution: no2e commentedI have the same "a" problem, but I don't use lightbox.
Did I understand it correct, that this is a problem with Imagecache? Will it be fixed officially? I don't want to edit code manually.
Comment #24
no2e CreditAttribution: no2e commented*bump* Help please.
Comment #25
libeco CreditAttribution: libeco commentedI can't answer your question if it will be fixed, but I followed the exact steps and eventually it worked. Just make sure you have a backup of the file you are editing just in case...
Comment #26
libeco CreditAttribution: libeco commentedSadly enough I just found out that the problem is still not fixed completely. When viewing a list created with views I still see the "a" as title and alt.
Comment #27
Kelmar-1 CreditAttribution: Kelmar-1 commentedIf you are using the Thickbox module then you will need to add the unserialize command to it as well.
Find the function in the thickbox.module file looking like so:
Modify to say:
I hope this helps.
Comment #28
libeco CreditAttribution: libeco commentedThanks but I'm not using thickbox. I have a problem with views. Perhaps someone else uses thickbox.
Thanks!
Comment #29
ar-jan CreditAttribution: ar-jan commentedThanks ComputerWolf for your code, fixed my problem.
Subscribing for updates on the issue.
Comment #30
drewish CreditAttribution: drewish commentedcould someone roll a patch for this?
marked #299991: CCK passing "a" to views as image title as a duplicate
Comment #31
pieterbezuijen CreditAttribution: pieterbezuijen commentedWorks for me! Thanks:)
Comment #32
ComputerWolf CreditAttribution: ComputerWolf commentedHere's the patch with my changes from #13.
Comment #33
scottrigbyPatch works for me Josh - thanks :)
too early to say 'reviewed & tested by the community?
I'm changing status because it seems the code works for a number of people, even before the patch was made.
Comment #34
alexanderpas CreditAttribution: alexanderpas commentedconfirming RTBC, and improwing title.
Comment #35
drewish CreditAttribution: drewish commentedthanks, committed to HEAD.
Comment #36
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #37
NecroHill CreditAttribution: NecroHill commentedI'm opening this Issue report again because I am using ImageField module with Views but without ImageCache and still have the issue with "a" in alt and title tags.
I installed latest ImageCache module (just to try) and included processed image (by ImageCache module) in my View and only after that I have alt tags displayed correctly.
Comment #38
Manuel Garcia CreditAttribution: Manuel Garcia commentedshouldn't you open a new issue for this then? You could always reference this issue as related information ;)
Comment #39
ariflukito CreditAttribution: ariflukito commentedhi 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.
Comment #40
pcave CreditAttribution: pcave commentedDid someone open a new issue? If so can you please add a reference here?
Comment #41
gleb1982 CreditAttribution: gleb1982 commentedHave the same problem as #37. I'm am using views and don't use image cache, and get "a" instead of the alt text.
Comment #42
gleb1982 CreditAttribution: gleb1982 commentedPlease help this "a" is very annoying :(
Comment #43
gleb1982 CreditAttribution: gleb1982 commentedI've updated all my moduls (including views) and the problem is now solved :)))))
Comment #44
alexanderpas CreditAttribution: alexanderpas commentedokay, seems that updating all your modules will fix the problem! (...)
Comment #45
GiorgosKJust updating Views will do (in my case)
Comment #46
jannalexx CreditAttribution: jannalexx commented(theming in views 2.x imagefield/imagecache title,alt and description)
how did you manage to print tittle, alt and description fields in views 2.x ?
It is working as expected in Lightbox, mouse over, and node-yourtype.tpl.php can also print those fields/items with provided theming functions.
But How can you do that in a view??
everything i tried didn't work . Views cannot see those imagefield special fields, so how can you print them for every image inside a view ? any ideas?? (probably somewhere in views theme tpl files or in template.php)
Comment #47
alexanderpas CreditAttribution: alexanderpas commented@jannalexx
could you please open a new support issue with your question.
Comment #48
jannalexx CreditAttribution: jannalexx commentedof course, you r right, I couldn't find anything on this, so I just asked because of the involved modules/situation included here, if someone has a clue there is already an open support issue here:
ways to represent imagefield title, description or alt fields in views 2 http://drupal.org/node/366434 , thanks
Comment #50
jiakomo CreditAttribution: jiakomo commentedI just upgraded to beta3 and images titles and alt text all became "a" in views. I didn't have this problem with alpha4...
Comment #51
GiorgosKPlease update to the latest views release and clear cache and report back
Comment #52
quicksketchThis indeed is still a problem in Views. The data is being properly unserialized on normal node display, but not when it's displayed in views. This is because the $op == 'load' field action only occurs for normal node display, and for views, only the the $op == 'sanitize' operation is run.
So currently at least, the solution is to simply unserialize() on sanitize also. This used to be the case in earlier versions, but I erroneously removed it when I thought it was no longer necessary.
I've re-added this unserialization to the "sanitize" operation, plus put in place the same temporary fix in place as #402860: Fatal error: CCK data field not always unserialized.
Comment #53
jiakomo CreditAttribution: jiakomo commentedPatch fixed this. Thank you.
Comment #54
scottrigby@quicksketch: thanks again :)
#52 works for me on 6.x-3.0-beta3
Comment #55
quicksketchNo problem, we'll get a new release out shortly to fix this for the masses.
Comment #57
Quinti CreditAttribution: Quinti commentedHi,
in Drupal 6.10 continuous showing:
<a alt=" " title=" "
in views getting the imagefield
greetings
Comment #58
sharlak CreditAttribution: sharlak commentedHi,
I am using Drupal 6.11, Views 2.5; FileField 3.0, ImageField 3.0 and ImageCache 2.0-beta8 and have a similar problem (alt is ""). I have seen the patch sent by #52 (which is included in FileField 3.0) and after debugging the code I see that after
$items[$delta]['data'] value is an array with "title", "alt" and "description" but the only field filled is the "description" (when we upload the image it is the only value we can fill, there is no place to fill the "alt" and "title"). Wouldn't be convenient to fill this information when we upload the image?
To solve the issue and get the accesibility requirements we need I fill the "alt" value with the "description", putting this line after the while sentence of the patch:
I know that this is an awful hack... but I do not have anything better while we wait a proper solution (giving alt and title values when uploading an image?).
Comment #59
Gabriel R. CreditAttribution: Gabriel R. commentedStill a problem.
Comment #60
quicksketchWe've already fixed this problem as far as I know. Is this on a fresh installation of 3.2? I'll need instructions on how to reproduce it from scratch, since it's been fixed for a long time and I don't know what steps would be necessary to reproduce it.
Comment #61
j_byrd CreditAttribution: j_byrd commentedFileField 6.x-3.2
ImageCache 6.x-2.0-beta10
ImageField 6.x-3.2
Views 6.x-2.8
No display of alt, title or description with images in Views. Alt and title appear within the img tag, but aren't available for display with the images. The data for first of the series of images is displayed, but not the data for the rest of the images.
Comment #62
quicksketchYou need to uncheck the option for "Group multiple values" when you add the ImageField to your view. CCK actually only pulls in the first item and then does a second query to pull in all the rest of the items when dealing with multiple values. So if you add the data column and your other fields are grouped, you only get the first row. From the sounds of things, this is a misunderstanding of the CCK/Views integration rather than a bug in ImageField.
Comment #63
quicksketchComment #64
drupalina CreditAttribution: drupalina commentedThis problem still exists when you use Views, Pictures from user.module and Imagecache_Profiles module.
I tried to create a block with user avatars, so that their usernames showed up as alt text, but unsuccessfully...
For anyone who bumps into this problem, to save you a lot of headache, I did a dirty hack in Imagecache_profiles.module in line 74 by replacing
t('View user picture')
with$account->name
It's a dirty hack, and definitely not a solution, but it seems that Imagecache (or maybe Imagecache_Profiles) still has this problem.
Comment #65
mgiffordtagging
Comment #66
mark. CreditAttribution: mark. commentedsubscribing.
Comment #67
mattys CreditAttribution: mattys commentedi had the alt problem, displaying 'a' and the image didn't link to node, linked to homepage, even though it was set to do so in views, so, i upgraded to latest versions of imagefield and filefield modules and it sorted it
Comment #68
quicksketchI'm not sure why this got moved to the ImageCache queue. It was a bug in FileField 3.5 (which affected users of ImageField) and had nothing to do with ImageCache. Please file a new issue for any similar problems rather than reopening this issue.
Comment #69
el_reverend CreditAttribution: el_reverend commentedHi all,
I ran into the same issue and experiment with the print theme function a bit. It seems that there is a problem with the FIRST variable passed to the function after the filepath.
When I print this in my code:
<?php print theme('imagecache', 'Feature-Images', $node->field_post_header_img[0]['filepath'], $title, $alt) ?>
I get this in the HTML:
<img src="http://drupal.dev/sites/default/files/imagecache/Feature-Images/featuredposts/OK028_COVER.jpg" alt="Article 3" title="" class="imagecache imagecache-Feature-Images" width="686" height="930">
But when I have this in code:
<?php print theme('imagecache', 'Feature-Images', $node->field_post_header_img[0]['filepath'], $alt, $title) ?>
I get:
<img src="http://drupal.dev/sites/default/files/imagecache/Feature-Images/featuredposts/OK028_COVER.jpg" alt="" title="Article 3" class="imagecache imagecache-Feature-Images" width="686" height="930">
Please not that neither the alt tag nor the title fields are 'Article 3'! They are filled out by the user on the edit form.
Comment #70
el_reverend CreditAttribution: el_reverend commentedI just found quick way to populate the theme function with the alt and title tags as entered by the user on an exposed filefield form:
Hope this helps.
Comment #71
fizk CreditAttribution: fizk commentedPlease reopen if this is still an issue with ImageCache 6.x-2.0-rc1.