Howto remove image title when we view acidfree thumbnails

kynsai - July 26, 2007 - 12:04

Hi,

I am trying to make a picture gallery but since i don't have a proper names for those pictures i don't want acidfree to display the title of the image.

Is there a way to remove it?

Am using drupal 5.x, acidfree, image_asst

Id like to know this too.

greymoth - April 7, 2008 - 04:38

Id like to know this too. Did you ever find out how?

You can override the

greymoth - April 7, 2008 - 05:04

You can override the acidfree-item style class in your theme's style.css file like this:

div.acidfree-item a {
display: block;
font-size: 0px;
}

but unfortunately this may be picked up as unethical SEO cloaking and could cause problems, like your google-rankings dropping.

Found a solution.

greymoth - April 7, 2008 - 22:19

Found a solution.

You need to override the theme_acidfree_print_thumb_image() function from acidfree's class_image.inc using your theme's template.php file. I was doing this already in order to get thickbox working with acidfree. (see http://drupal.org/node/169801#comment-700793 for details.)

Copy the original theme_acidfree_print_thumb_image function from class_image.inc in the acidfree folder, and paste it into your theme's template.php file. Rename it to phptemplate_acidfree_print_thumb_image, as shown below. Finally, just remove the <p>$title</p> in the second to last line.

This is the edited function:

function phptemplate_acidfree_print_thumb_image(&$node, $parent=null) {
    $vid = acidfree_get_vocab_id();
    if (count($node->taxonomy[$vid]) > 1 && $parent) {
        $p = "pid={$parent->tid}";
    }
    $info = image_get_info(file_create_path($node->images['thumbnail']));

    $image = _acidfree_image_display($node, 'thumbnail', array('width' => $info['width'], 'height' => $info['height']));
   
    $h = $info['height'] + variable_get('acidfree_extra_length',12);
    $w = $info['width'] + variable_get('acidfree_extra_length',12);
   
    $path = "node/{$node->nid}";
    $overlay = l('', $path, array('title' => $node->title), $p, NULL, true, true);
    $image = l($image, $path, array('title' => $node->title), $p, NULL, true, true);
    $title = l($node->title, $path, array('title' => $node->title), $p, NULL, true, true);

    $imagediv = '<div class="acidfree-cell"><div class="acidfree-item acidfree-image">';
    $imagediv .= "<div class='acidfree-thumbnail' style='width: {$w}px; height: {$h}px;'>";
    $imagediv .= $image . '<div class="acidfree-overlay">' . $overlay . '</div></div>';
    $imagediv .= "</div></div>";
    /* (  the above line used to say this:  $imagediv .= "<p>$title</p></div></div>"; */
    return $imagediv;
}

I expect there is s similar way to remove the title from the full-image view, if you are not using thickbox, as I am.

 
 

Drupal is a registered trademark of Dries Buytaert.