用于非图像 CCK 的图像缓存?

发布于 2024-09-05 04:26:51 字数 234 浏览 3 评论 0原文

我正在创建一个包含图像、视频、音频和文档(书籍)的视图,我喜欢在轮播中显示它们中的每一个的图片。

只要我们向其 CCK 添加图像缩略图(图像文件字段),一切都可以很好地处理图像和视频,但我们希望在不更改原始 CCK 的情况下显示音频和文档的默认图像。是否可以使用imagecache(可能使用imagecache_custom_code或views_custom_php)或者我们需要寻找不同的方法?

感谢您的帮助, 米。

I'm creating a view with images, videos, audio and documents (books) and I like to shown a picture of each of them in a carousel.

Everything works nicely with images and videos as far as we added a image-thumbnail (image filefield) to their CCK but we like to show a default image for audio and documents without changing the original CCK. Is it possible with imagecache (may be with imagecache_custom_code or views_custom_php) or we need to look for a different approach?

Thanks for your help,
m.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

空名 2024-09-12 04:26:51

您可以从两个地方执行此操作。

首先,您可以进入 CCK 内容类型设置的显示字段部分,并更改其在预告片和节点视图中的默认显示。您将获得所有当前图像缓存预设作为显示大小选项。

其次,您还可以更改作为视图一部分的输出。将图像添加为要显示的字段将为您提供相同的预设选项集。

You are able to do this from two places.

First, you can go into Display Fields part of the CCK content type settings and change its default display in the teaser and node view. You will be given all the current imagecache presets as sizing options for display.

Second, you can also change the output as part of Views. Adding the image as a Field to show will give you the same set of preset options.

时光清浅 2024-09-12 04:26:51

我要说的内容与上面的凯文非常相似,但我认为这是您正在寻找的解决方案。要理解这个问题:

  • 您有 3 种内容类型,其中两种有缩略图,您可以单独设置
  • 第三种内容类型,您希望显示默认图像但不必设置它,

我认为您仍然应该使用 cck 字段。

我可能会误解你的问题。

I'm going to say something very similar to Kevin above but I think it's the solution your looking for. To understand the problem:

  • you have 3 content types, two have thumbnails that you set individually
  • for the third you would like to have a default image displayed but not have to set it

I think you should still use a cck field.

I might be mis-understanding your issue though.

静水深流 2024-09-12 04:26:51

感谢你们俩的帮助。

我认为你仍然应该使用 cck 字段。
你很好地描述了这个场景,但这正是我试图避免的重点。 :-)

我不想对书籍使用 cck 字段,也不想用 hook_form_alter 隐藏它。

我想我终于找到了一个不需要向我的“非图像”内容类型(音频和文本)添加额外的 CCK 字段的解决方案。

有一个名为“视图自定义字段”的模块 (drupal.org/project/views_customfield),它允许您将 PHP 处理的字段添加到视图中,这样您就可以按内容类型进行过滤并应用 imagecache 或 imageapi 代码

$node=node_load($data->nid);
$img_path=drupal_get_path("module", "gt_medias") . "/images";

switch ($node->type) {
  case "gt_video":
    $img_path = $node->field_gt_thumbnail[0][filepath];
  break;
  case "book":
    $img_path .= "/bookDefault.jpg";
  break;
  case "gt_audio":
    $img_path .="/audioDefault.png";
  break;
  case "pingv_image":
    $img_path = $node->field_pingv_image[0][filepath];
  break;
}

$imgcache_url = imagecache_create_url('gt_medias_video_346', $img_path);

$output .= '<img src="'. $imgcache_url .'" ' />';
return ($output);

其中“gt_medias_video_346 " 是我的图像缓存预设的名称。

再次感谢你们的帮助,

m。

Thanks for your both for your help.

I think you should still use a cck field.
You took a good picture of the scenario, but this is exactly the point of what I was trying to avoid. :-)

I don't want to use a cck field for books and I don't want to hide it with hook_form_alter.

I think I finally found a solution that didn't require adding extra CCK-fields to my "non-image" content types (audio and text).

There is a module called "Views custom field" (drupal.org/project/views_customfield) that allows you to add a PHP-processed-field to your view, so you can filter by content type and apply imagecache or imageapi code

$node=node_load($data->nid);
$img_path=drupal_get_path("module", "gt_medias") . "/images";

switch ($node->type) {
  case "gt_video":
    $img_path = $node->field_gt_thumbnail[0][filepath];
  break;
  case "book":
    $img_path .= "/bookDefault.jpg";
  break;
  case "gt_audio":
    $img_path .="/audioDefault.png";
  break;
  case "pingv_image":
    $img_path = $node->field_pingv_image[0][filepath];
  break;
}

$imgcache_url = imagecache_create_url('gt_medias_video_346', $img_path);

$output .= '<img src="'. $imgcache_url .'" ' />';
return ($output);

Where "gt_medias_video_346" is the name of my imagecache preset.

Once again, thanks you both for your help,

m.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文