如何让 Drupal 编辑器在上传到 imagefield 时选择图像缓存预设?

发布于 2024-12-28 22:54:47 字数 280 浏览 2 评论 0原文

有人知道有一个模块允许内容编辑者单独为每个节点选择图像缓存预设吗? 我希望编辑人员每次将图像上传到图像字段时都能够在 3 种不同的预设之间进行选择。

我已经考虑过的事情:

  • 添加选项字段以进行预设选择,然后检查这些 节点模板内的选项用于输出右侧的图像 预设。前段时间这样做过,但维护起来不好 进行更改或添加内容类型。
  • 有 3 个图像字段,每个预设一个,并使用单选按钮和条件字段模块仅显示当前选定的图像字段。 不幸的是,还不建议在 Drupal 7 上的生产环境中使用条件字段。

Is somebody aware of a module that allows content editors to select an imagecache preset for each node individually?
I'd like my editors to be able to choose between 3 different presets each time they upload an image to an imagefield.

Things I already considered:

  • Adding option fields to make a preset selection and then check those
    options inside the node template to output the image with the right
    preset. Did that sometime ago but it's not good to maintain when
    making changes or adding content types.
  • Having 3 imagefields, one for each preset and using radio buttons and Conditional Fields module to only display the currently selected imagefield.
    Unfortunately Conditional Fields is not recommended for production on Drupal 7 yet.

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

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

发布评论

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

评论(2

笨死的猪 2025-01-04 22:54:47

似乎确实有一个,格式化程序字段

使用此模块,您可以向页面节点添加格式化程序字段,它连接到图像字段。然后,当创建或编辑节点时,可以为每个节点选择图像样式。

它执行如下操作:

Field Formatter example

这看起来像您所追求的。

请注意,目前它处于 -beta2 版本,因此可能需要一些测试

There does appear to be one, Formatter Field:

With this module, you can add a formatter field to page nodes, which is hooked up to the image field. Then when the node is created or edited, the image style can be selected per-node.

It does something like this:

Field Formatter example

Which looks like what you're after.

Be aware it's in -beta2 at the moment so might need a bit of testing

蝶…霜飞 2025-01-04 22:54:47

“添加选项字段以进行预设选择,然后检查节点模板内的这些选项以输出具有正确预设的图像”

  • 在主题的 template.php 文件中的 theme_preprocess_node 中创建该函数比在 node.tpl.php 中创建函数更好。这样您就可以更好地维持病情。

“尚不建议在 Drupal 7 上的生产中使用条件字段”

  • 我不确定 D7 中条件字段模块的路线图是什么,因为 D7 表单 API 本身中已添加了类似的功能。
    您可能想检查以下链接:

http:// /api.drupal.org/api/examples/form_example--form_example_states.inc/function/form_example_states_form/7

http://randyfay.com/states

"Adding option fields to make a preset selection and then check those options inside the node template to output the image with the right preset"

  • It would be better to create the function in theme_preprocess_node in your theme's template.php file than node.tpl.php. This way you can maintain the condition in a much better way.

"Conditional Fields is not recommended for production on Drupal 7 yet"

  • I am not sure whats the road map for conditional field module in D7 as similar feature has been added in the D7 form API itself.
    You might like to check the following links:

http://api.drupal.org/api/examples/form_example--form_example_states.inc/function/form_example_states_form/7

http://randyfay.com/states

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