在店面的產品的圖像的屬性存儲在view.xml用配置文件英寸本主題提供有關屬性可什么和如何配置它們的所有細節。
**配置view.xml用圖片屬性**
view.xml用為主題的常規位置為:
~~~
<theme_dir>/etc/view.xml
~~~
例如,下面是Magento的空白主題view.xml用:
~~~
app/design/frontend/Magento/blank/etc/view.xml
~~~
在view.xml中圖像屬性中的范圍<images module="Magento_Catalog">
~~~
<images module="Magento_Catalog">
...
<images/>
~~~
圖像性能配置由元素的id和type屬性定義的每個圖像類型:
~~~
<images module="Magento_Catalog">
<image id="unique_image_id" type="image_type">
...
</image>
<images/>
~~~
下表詳細介紹的屬性:
~~~
id string 形象標識。獨一無二的主題范圍。
可為任意值,但外的任何─盒Magento的主題ID是有意義的,描述圖像的位置。
例如,id值對于交叉銷售產品圖像購物卡顯示為cart_cross_sell_products。
的ID在一個.phtml模板用于定義類型和特定的頁面上顯示在每個特定位置的圖像的屬性。
~~~
~~~
該類型由指定ID定義的圖像。允許值:
image - 對應于Magento管理基礎映像作用
small_image - 對應于Magento管理的小角色形象
swatch_image - 對應于Magento管理斯沃琪形象的作用
swatch_thumb - 對應于Magento管理斯沃琪形象的作用。
thumbnail - 對應于Magento管理縮略圖作用
~~~
圖像屬性由相應的元件定義,例如:
~~~
<images module="Magento_Catalog">
<image id="unique_image_id" type="image">
<width>100</width> <!-- Image width in px -->
<height>100</height> <!-- Image height in px -->
</image>
</images>
~~~
下表包含了可配置的所有屬性的列表:
~~~
屬性 類型 描述 需要
width integer Image width in pixels. Optional
height integer Image height in pixels. Optional
constrain boolean If set to true, images that are smaller than required by the configuration, are not enlarged. Default value: true. Optional
aspect_ratio boolean If set to true, proportions of images are not changed even if required by the configuration. Default value: true. Optional
frame boolean If set to true, images are not cropped. Default value: true. Applied only if aspect_ratio is set to true. Optional
transparency boolean If set to true, the transparent background of images is saved. If is set to false, images have the white background (by default). You can set the color for the background using the background parameter. Default value: true. Optional
background array The color for the images background. Not applied to images with transparency, if transparency is set to true. Optional
~~~
**調整目錄圖片**
Magento的catalog:images:resize,您可以將圖像尺寸調整為您的店面展示;例如:
導入產品后,可能具有可變大小的圖像
如果圖像大小或從緩存中手動刪除
分配給產品的每個圖像必須根據在模塊的view.xml用配置文件定義的圖像的元數據的大小。調整圖像大小后,它的大小副本存儲在緩存中(/pub/media/catalog/product/cache目錄)。 Magento的從緩存中提供店面形象
一般情況下,同時節省了產品的產品圖片被緩存。不過,有時你可能需要重新創建一個使用此命令,例如產品圖片緩存,進口產品后,如果圖像手動調整在緩存中,或者如果緩存被錯誤手動清除。
命令的用法:
php <magento install dir>/bin/magento catalog:images:resize
該命令沒有參數或選項。一個進度指示器顯示的同時運行該命令。
成功地調整消息產品圖片顯示Product images resized successfully,以確認命令成功。
- 前端開發
- 前端開發人員指南
- 介紹
- 主題模塊路徑規則符號
- 主題Themes
- 概括
- 創建主題
- magento主題結構
- 應用和配置管理主題
- 配置圖片屬性主題
- 主題繼承
- 定位模板,布局和樣式
- 布局layout
- 布局說明
- 布局文件類型
- 擴展繼承布局
- 覆蓋布局
- 公共布局任務定制
- 自定義布局圖
- 模板Templates
- 模板定制演練
- 模板的基本概念
- 定制的模板插圖
- 定制電子郵件模板
- 模板XSS安全
- 層疊樣式表(css)
- 載入css
- magento繼承修改模板.phtml
- 只修改phtml文字內容
- 在magento的block之前加內容
- PHP開發
- PHP開發人員指南
- 開發路線圖
- composer簡介
- 常見術語表
- 準備(開發快速啟動)
- 組件類型和版本
- 有關組件文件結構
- 路線圖制定和包裝組件
- 建立
- composer.json文件
- 創建組件文件結構
- 定義你的配置文件
- 注冊您的組件
- URN架構驗證
- 命名部件
- 組件加載順序
- 啟用或禁用組件
- package包
- 打包組件
- 更新
- 驗證
- 測試你的組件
- 加入CLI命令
- 命令命名指南
- 如何添加CLI命令
- 組件開發
- 服務合同
- 公共接口和API
- 服務合約設計模式
- 依賴注入
- 實例化對象與工廠
- 代理
- 代碼生成
- EAV和擴展屬性
- Magento的插件
- 路由
- 索引
- 配置服務網絡的API
- 向后兼容性
- 消息隊列
- 在開發過程中清除目錄
- magento設置
- magento開發模式設置
- magento安裝中文語言包
- 創建一個新的block
- magento后臺操作
- 調試-頁面phtml所在的目錄
- magento添加分類
- 添加屬性
- 屬性組
- 組合商品
- 配置商品
- 虛擬商品
- 捆綁商品
- 可下載商品
- 商品促銷設置
- CMS頁面設置
- block使用
- connect使用
- 多店鋪
- 聯系我們
- paypal設置
- 物流運費
- 網站地圖
- 訂單處理
- 賬號管理
- 網站貨幣設置
- google分析
- 頁面默認設置
- Magento技巧積累
- 常用技巧
- magento2更改商品圖片在網站中不同位置的大小
- magento的view里面的default.xml