Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/amasty/shopby/Model/Category/Attribute/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/amasty/shopby/Model/Category/Attribute/Image.php
<?php
/**
 * @author Amasty Team
 * @copyright Copyright (c) Amasty (https://www.amasty.com)
 * @package Improved Layered Navigation Base for Magento 2
 */

namespace Amasty\Shopby\Model\Category\Attribute;

use Magento\Catalog\Model\Category as CategoryModel;
use Amasty\Shopby\Model\Media\ImageProcessor;

class Image
{
    /**
     * @var ImageProcessor
     */
    protected $imageProcessor;

    /**
     * Image constructor.
     * @param ImageProcessor $imageProcessor
     */
    public function __construct(
        ImageProcessor $imageProcessor
    ) {
        $this->imageProcessor = $imageProcessor;
    }

    /**
     * @param string $imageAttributeCode
     * @param CategoryModel $category
     * @return void
     */
    protected function processImage($imageAttributeCode, CategoryModel $category)
    {
        $rawData = $category->getData($imageAttributeCode);

        if (!$rawData) {
            $category->setData($imageAttributeCode, null);
        }

        if ($rawData && is_array($rawData)) {
            if (isset($rawData[0]['file']) && isset($rawData[0]['url'])) {
                $category->setData($imageAttributeCode, $rawData[0]['file']);
                $this->imageProcessor->resize($rawData[0]['file'], $imageAttributeCode);
            } else {
                $category->unsetData($imageAttributeCode);
            }
        }
    }
}

Spamworldpro Mini