【发布时间】:2018-07-04 03:33:37
【问题描述】:
我正在 Magento2 平台上建立一个站点。 我需要为艺术家完成的绘画添加图像以供出售。
需要的是,除了要上传的图片之外,我还想在绘画中添加 2-3 个预定义的背景图片。 例如 - 餐厅、客厅。
我可以使用此代码(随机)更改每次页面加载时的背景图像。
<head>
<style type="text/css">
<!--
body{
background: url(images/<?php echo $selectedBg; ?>) no-repeat;
}
-->
</style>
</head>
<?php
$bg = array('SET_A_01_Living.jpg', 'SET_A_02_Bed.jpg', 'SET_A_03_Study.jpg', 'SET_A_04_Dining.jpg' ); // array of filenames
$i = rand(0, count($bg)-1); // generate random number size of the array
$selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen
?>
但是我如何将背景添加到图像和 Magento Gallery 中,我无法弄清楚。
对此的一些指导/提示将帮助我实现我正在尝试做的事情。
【问题讨论】:
标签: php css image magento magento2