b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / Infortis / Infortis / Helper /
Filename/home/dev2.destoffenstraat.com/app/code/Infortis/Infortis/Helper/Image.php
Size3.47 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified06-Apr-2021 18:06
Last accessed22-Aug-2025 01:14
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php

namespace Infortis\Infortis\Helper;

use Magento\Catalog\Helper\Image as HelperImage;
use Magento\Catalog\Model\Product;
use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Framework\App\Helper\Context;

class Image extends AbstractHelper
{
/**
* @var Image helper
*/
protected $helperImage;

public function __construct(
Context $context,
HelperImage $helperImage
) {
$this->helperImage = $helperImage;
parent::__construct($context);
}

/**
* Get URL of product image
*
* @param Product $product Product
* @param string $imageTypeId Image type identifier
* @param int $w Image width
* @param int $h Image height
* @return string
*/
public function getImageUrl($product, $imageTypeId = 'product_base_image', $w = null, $h = null)
{
$this->helperImage
->init($product, $imageTypeId);

if ($w || $h)
{
if ($w && $h)
{
$this->helperImage
->resize($w, $h);
}
else
{
$this->helperImage
->constrainOnly(true)
->keepAspectRatio(true)
->keepFrame(false)
->resize($w, $h);
}
}

return $this->helperImage->getUrl();
}

/**
* Get URL of product image
*
* @param Product $product Product
* @param string $imageTypeId Image version
* @param int $w Image width
* @param int $h Image height
* @param mixed $file Image file
* @param array $attributes Attributes
* @return string
*/
public function getImageUrlExtended($product, $imageTypeId = 'product_base_image', $w = null, $h = null, $file = null, $attributes = [])
{
$this->helperImage
->init($product, $imageTypeId, $attributes);

if ($file != null)
{
$this->helperImage
->setImageFile($file);
}

if ($w || $h)
{
if ($w && $h)
{
$this->helperImage
->resize($w, $h);
}
else
{
$this->helperImage
->constrainOnly(true)
->keepAspectRatio(true)
->keepFrame(false)
->resize($w, $h);
}
}

return $this->helperImage->getUrl();
}

/**
* @deprecated
* Wrapper for new method, left for backward compatibility
*/
public function getImg($product, $imageTypeId = 'product_base_image', $w = null, $h = null)
{
// TODO: remove
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/Infortis_Infortis.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('Deprecated method: Infortis\Infortis\Helper\Image::getImg(...)'); ///

return $this->getImageUrl($product, $imageTypeId, $w, $h);
}

/**
* @deprecated
* Wrapper for new method, left for backward compatibility
*/
public function getImgExtended($product, $imageTypeId = 'product_base_image', $w = null, $h = null, $file = null, $attributes = [])
{
return $this->getImageUrlExtended($product, $imageTypeId, $w, $h, $file, $attributes);
}
}