从 Viber 键盘按钮图像中获取错误图像
Getting wrong image out from Viber's keyboard button's Image
我正在使用 PHP 通过 Viber REST API 创建一个 Viber 机器人。我试图了解如何创建由 Viber 设置的键盘设计,但无济于事。如何使它看起来与Viber的键盘设计提供的示例相同?
[
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Smoking',
'BgColor' => '#f7bb3f',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/smoking.png',
],
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Non Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Non smoking',
'BgColor' => '#f6f7f9',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/no-smoking.png',
],
]
Viber 尝试拉伸小图像来填充按钮,虽然有办法控制哪个轴最大以及是否裁剪图像,但无法阻止这种拉伸。
您可以将每个按钮保存为 high-resolution 图像(包括文本和图标),然后将该图像用作按钮的 'image' 属性 的值。
或者,您可以放大当前图像的透明背景,使图像总尺寸更大并可以填充按钮(例如 100x100 像素),而图标大小保持不变(24x24 像素)。但是,这种方法的缺点是您需要找到如何在图像中定位图标,使其不与文本重叠。因此,之前建议使用包含文本和图标的高分辨率图像通常更可取。
我正在使用 PHP 通过 Viber REST API 创建一个 Viber 机器人。我试图了解如何创建由 Viber 设置的键盘设计,但无济于事。如何使它看起来与Viber的键盘设计提供的示例相同?
[
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Smoking',
'BgColor' => '#f7bb3f',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/smoking.png',
],
[
'Columns' => 3,
'Rows' => 2,
'Text' => '<font color=\"#494E67\">Non Smoking</font><br><br>',
'TextSize' => 'medium',
'TextHAlign' => 'center',
'TextVAlign' => 'bottom',
'ActionType' => 'reply',
'ActionBody' => 'Non smoking',
'BgColor' => '#f6f7f9',
'Image' => 'https://img.icons8.com/material-outlined/24/000000/no-smoking.png',
],
]
Viber 尝试拉伸小图像来填充按钮,虽然有办法控制哪个轴最大以及是否裁剪图像,但无法阻止这种拉伸。
您可以将每个按钮保存为 high-resolution 图像(包括文本和图标),然后将该图像用作按钮的 'image' 属性 的值。
或者,您可以放大当前图像的透明背景,使图像总尺寸更大并可以填充按钮(例如 100x100 像素),而图标大小保持不变(24x24 像素)。但是,这种方法的缺点是您需要找到如何在图像中定位图标,使其不与文本重叠。因此,之前建议使用包含文本和图标的高分辨率图像通常更可取。