Closed (fixed)
Project:
Dynamic display block
Version:
6.x-1.0-rc6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 May 2009 at 09:18 UTC
Updated:
3 Jan 2014 at 00:29 UTC
Jump to comment: Most recent
Comments
Comment #1
ppblaauw commentedDepends on what functionality you use:
Basic slideshow option:
Images from a folder: Only if you add it in the template file for all slideshows for all images.
Other options: yes
Advanced slideshow option:
Alt text of imagefield: yes
Please let me know what functionality you use of the dynamic display block module.
Comment #2
jrosen commentedI am currently using the Basic slideshow option - Images from a folder.
I have not really looked into the Advanced option yet.
Comment #3
ppblaauw commentedYour only option is:
Hope this helps you further, please let me know
Comment #4
dgautsch commentedI think the easiest thing to do is to add a title filed through cck that's associated with your image. I believe it's an option with imagefield. I'd look into that before you go edit the php.
Comment #5
ppblaauw commented@logicalriot
When using the basic slideshow option with image from a folder it doesn't have to be an image from filefield. It can just be an image uploaded via FTP. There is no alt property with images from a folder.
The only option is adding it in the the template file ddblock-cycle-block-content.tpl.php in your theme.
In the issue is stated: I am looking to set the ALT attribute of the IMG tag created by DDBlock. I am even OK if all the images in the slideshow use the same ALT value.
Adding the alt value to the template file is really the easiest option to do this.
Comment #6
jrosen commented@ppblaauw:
Thanks for pointing me in the right direction...
I changed the
ALTvalue to the following:alt="<?php print ucwords(str_replace(array("_","-"), " ", pathinfo($image_file, PATHINFO_FILENAME))); ?>"It takes the image filename, replaces any underscores (_) or dashes (-) with spaces and capitalizes the first letter of each word in the filename. For example, it takes "my_product_name_photo_1" and converts it to "My Product Name Photo 1".
I find this very useful for SEO purposes and think it would be a good addition to the ddblock code.
Can you add this change in to the codebase?
Thanks,
Jason
Comment #7
ppblaauw commentedJason,
Will implement your solution in next version of the module.
(Better to have a default value than a space.)
Until then you can theme it yourself in the template file (described in #3) if needed.
Thanks for the snippet.
Changed the Issue text
Add a tag
Comment #8
dgautsch commentedhi ppblaauw so how would you do this with the advanced slide option when you use file_field to define a custom ALT text?
I've tried entering this code into the template.php but it doesn't seem to work. Maybe I'm going about this wrong:
$result->field_image_data['alt']Comment #9
ppblaauw commentedThe alt text of an image field is stored as serialized data. You can get the data with e.g.
Uncomment the drupal_set_message line in the preprocess functions and you will see the image field data field_name. In the example above it is: node_data_field_gallery_image_field_gallery_image_data. Replace it with the field_name of your image field.
Like above you need to unserialize the data and then use the $data['alt'] variable instead of the data['title'] variable like above.
Hope this helps you further, please let me know.
If you can not make it work, please attach your template.php file and the result of the drupal_set_message debug lines, so I can help you better.
Comment #10
dgautsch commentedThanks again, that was what i was missing. I didn't realize i had to unserialize the data. Shortly after I posted my previous post, i found the data field_name i was missing. Thanks again!
Comment #11
dgautsch commented