如何为所有 ctypes 设置 focusArea [英] How to set focusArea for all ctypes
问题描述
在这里我找到了如何为所有 ctypes 设置全局作物变体的信息.
Here i found the information how to set global crop variants for all ctypes.
现在我想为所有 ctypes 设置一个 focusArea.最好的方法是什么?
Now i want to set a focusArea for all ctypes. What would be the best way?
'focusArea' => [
'x' => 1 / 3,
'y' => 1 / 3,
'width' => 1 / 3,
'height' => 1 / 3,
],
推荐答案
希望您使用扩展来提供模板.在这种情况下,您可以将以下代码添加到 your_extension/Configuration/TCA/Overrides/sys_file_reference.php
Hopefully you are using an extension to provide your templates. In this case you can add the following code to your_extension/Configuration/TCA/Overrides/sys_file_reference.php
$GLOBALS['TCA']['sys_file_reference']['columns']['crop']['config']['cropVariants'] = [
'demo' => [
'title' => 'Demo',
'allowedAspectRatios' => [
'4:3' => [
'title' => '4:3',
'value' => 4 / 3
],
],
'selectedRatio' => '4:3',
'cropArea' => [
'x' => 0.0,
'y' => 0.0,
'width' => 1.0,
'height' => 1.0,
],
'focusArea' => [
'x' => 1 / 3,
'y' => 1 / 3,
'width' => 1 / 3,
'height' => 1 / 3,
],
'coverAreas' => [
[
'x' => 0.05,
'y' => 0.85,
'width' => 0.9,
'height' => 0.1,
]
],
],
];
这将添加cropVariant demo
:
This will add the cropVariant demo
with:
- 4:3 的纵横比
- 您要求的焦点区域,宽度和高度为 33%,位于图像的中间
- 图像底部的覆盖区域
请注意,这将应用于所有 sys_file_reference 而不仅仅是 CTypes,因此页面、新闻等也会受到影响.
Please note, that this will be applied to all sys_file_reference and not only to CTypes, so pages, news and so on will be also affected.
这篇关于如何为所有 ctypes 设置 focusArea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!