How to get placeholder image url Magento2?

    use  \Magento\Store\Model\StoreManager $storeManager

    $this->storeManager = $storeManager;
    $path =
    catalog/placeholder/thumbnail_placeholder OR
    catalog/placeholder/swatch_image_placeholder OR
    catalog/placeholder/small_image_placeholder OR
    catalog/placeholder/image_placeholder OR

     public function getConfig($config_path)
        {
            return $this->storeManager->getStore()->getConfig($config_path);
        }

<img src = $mediaUrl.'catalog/product/placeholder/'.$this->getConfig($path) />
    $mediaUrl = $this ->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA );

On Magento 2.2:

  • Get Helper in Block (phtml)
    $imageHelper = $this->helper(\Magento\Catalog\Helper\Image::class);

  • Get Helper Global
    $imageHelper = \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Helper\Image::class);

  • Get Placeholder Image Url. User as parameter: 'image', 'smal_image', 'swatch_image' or 'thumbnail'.
    $placeholderImageUrl = $imageHelper->getDefaultPlaceholderUrl('image');


If you check your store settings you will find option of Product Image place holders

Stores > Configuration > Catalog > Catalog > Product Image Placeholders

You can call the get the value in block and call in your template file.

<?php 

protected $_scopeConfig;

public function __construct
(
    ---
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ---

){
    ---
    $this->_scopeConfig = $scopeConfig;
    ---
}

public function getPlaceholderImage(){
    return $this->_scopeConfig->getValue('catalog/placeholder/image_placeholder'); // Base Image
    $this->_scopeConfig->getValue('catalog/placeholder/small_image_placeholder'); // Small Image
    $this->_scopeConfig->getValue('catalog/placeholder/swatch_image_placeholder'); // Swatch Image
    $this->_scopeConfig->getValue('catalog/placeholder/thumbnail_placeholder'); // Thumbnail Image
}

In Your Template File Call

$block->getPlaceholderImage();

To get the placeholder image url on the product listing page template, do this:

$imageUrl = $block->getImage($block->getProduct(), 'category_page_grid')->getImageUrl();