Jump to content

Edit History

You need to override core code in src/Adapter/Product/Image/ProductImagePathFactory.php

    public function getPathByType(ImageId $imageId, string $type, string $extension = self::DEFAULT_IMAGE_FORMAT): string
    {
        $path = $this->getBaseImagePathWithoutExtension($imageId);
        return sprintf('%s-%s.%s', $path, $type, $extension);
    }

 

You need to override core code in src/Adapter/ImageManager.php

    public function getThumbnailForListing($imageId, $imageType = 'jpg', $tableName = 'product', $imageDir = _PS_PRODUCT_IMG_DIR_)
    {
        $thumbPath = $this->getThumbnailTag($imageId, $imageType, $tableName, $imageDir);

        // because legacy uses relative path to reach a directory under root directory...
        $replacement = 'src="' . $this->legacyContext->getRootUrl();
        $thumbPath = preg_replace('/src="(\\.\\.\\/)+/', $replacement, $thumbPath);

        return $thumbPath;
    }

 

×
×
  • Create New...