PHP code example of studioraz / magento2-category-image
1. Go to this page and download the library: Download studioraz/magento2-category-image library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
studioraz / magento2-category-image example snippets
public function getAdditionalImageTypes()
{
return array('thumbnail', '{image-attribute-code}');
}
protected function getAdditionalImages() {
return array('thumbnail', '{image-attribute-code}');
}
$category = 'load a category model class here'; // the decision how to load category model object is up to you.
$helper = $this->helper('SR\CategoryImage\Helper\Category');
$imageUrl = $helper->getImageUrl($category->getData('image-attribute-code'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.