1) Create or override the listing.xml file and add the below code
<column name="custom_image" component="Magento_Ui/js/grid/columns/thumbnail" class="VendorModuleUiComponentListingColumnThumbnail">
<settings>
<filter>text</filter>
<label translate="true">Custom Image</label>
<hasPreview>1</hasPreview>
<sortable>false</sortable>
</settings>
</column>
2) Create Thumbnail.php and add the below code
<?php
namespace VendorModuleUiComponentListingColumn;
use MagentoFrameworkUrlInterface;
use MagentoFrameworkViewElementUiComponentContextInterface;
use MagentoFrameworkViewElementUiComponentFactory;
use MagentoStoreModelStoreManagerInterface;
use MagentoUiComponentListingColumnsColumn;
class Thumbnail extends Column
{
const NAME = 'thumbnail';
const URL_PATH_EDIT = 'moudle/controller/edit';
/**
* @var StoreManagerInterface
*/
protected $storeManager;
/**
* @var UrlInterface
*/
protected $url;
/**
* Image constructor.
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param StoreManagerInterface $storeManager
* @param UrlInterface $url
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
StoreManagerInterface $storeManager,
UrlInterface $url,
array $components = [],
array $data = [],
MagentoThemeBlockHtmlHeaderLogo $logo
) {
parent::__construct($context, $uiComponentFactory, $components, $data);
$this->storeManager = $storeManager;
$this->url = $url;
$this->_logo = $logo;
}
/**
* Prepare Data Source
*
* @param array $dataSource
* @return array
*/
public function prepareDataSource(array $dataSource)
{
$mediaUrl = $this->storeManager->getStore()->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
if (isset($dataSource['data']['items'])) {
$fieldName = 'custom_image';
foreach ($dataSource['data']['items'] as & $item) {
if (!empty($item['custom_image'])) {
$name = $item['custom_image'];
$item[$fieldName . '_src'] = $mediaUrl.'custom/image'.$name;
$item[$fieldName . '_alt'] = '';
$item[$fieldName . '_link'] = $this->url->getUrl(static::URL_PATH_EDIT, [
'id' => $item['id']
]);
$item[$fieldName . '_orig_src'] = $mediaUrl.'custom/image'.$name;
}
}
}
return $dataSource;
}
}
under the Vendor/Module/Ui/Component/Listing/Column

