2006年9月17日星期日

Drupal Acidfree模块图片显示的问题

最近在用Drupal,尝试实现一个想法,搭建一个网站。
使用了Acidfree模块,但是发现缺省情况下,影集的图片无法正常显示,出现下图的错误:

所有的微缩图均无法显示,显示源程序,发现链接是错误的,我的链接为
src="8080/drupal/files/active/0/27_thumb.jpg"
(8080是我的Apache端口,非标准的80),追踪代码到acidfree的classphoto.inc页面,找到函数theme_acidfree_print_thumb_photo,代码如下:

  1. function theme_acidfree_print_thumb_photo(&$node, $parent=null) {
  2. if (count($node->parent) > 1 && $parent)
  3. $p = "pid={$parent->nid}";
  4. $image = l(theme('image', _acidfree_get_thumb_url($node),
  5. $node->title, $node->title, array('class'=>'acidfree'), false),
  6. "node/{$node->nid}", array(), $p, NULL, true, true);
  7. $size = variable_get('acidfree_thumb_dim', IMAGE_THUMB_SIZE) + 40;
  8. $cell .= "
    \n";
  9. $size -= 20;
  10. $cell .= "
    \n";
  11. // XXX: this empty span is to make IE render vertical alignment correctly
  12. $cell .= "\n";
  13. $cell .= "$image\n";
  14. $cell .= "\n";
  15. $cell .= "
    {$node->title}
    \n";

  16. $cell .= "\n";
  17. return $cell;
  18. }



通过_acidfree_get_thumb_url($node)函数,返回的是图片的正确、可访问的路径,然而经过主题的函数
theme('image', _acidfree_get_thumb_url($node),
$node->title, $node->title, array('class'=>'acidfree'), false),
"node/{$node->nid}", array(), $p, NULL, true, true)
处理过之后,就变成了错误的路径,于是找到includes\theme.inc处理函数,找到theme_image函数,该函数用于返回图片的路径,发现有以下的语句:

check_url(base_path() . $path)$base_path的值为 /drupal/$path的值为http://localhost:8080/drupal/files/active/0/25_thumb.jpg


不知道在后台处理的时候为什么报错。将以上语句改为:




check_url($path)可以正常显示了。还发现一个问题,就是在IE浏览器下面和Firefox浏览器下面显示居然差别非常大。





这种主题的错误的错误还是比较严重的,不知道是不是我的配置出了问题。





(IE下面的效果,图片没有居中)


(FireFox下面的效果,图片是居中显示的。)




PS:用Blogger写Blog可真是够麻烦的。每次上传图片都跑到页面的最上面,还要手工用CTRL+X、CTRL+V粘贴到最后;粘贴代码也不够好。


没有评论: