6

I have added renderer in Grid.php as below:

$this->addColumn(
    'image',
    array(
        'header' => __('Image'),
        'index' => 'image',
        'renderer'  => \YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image,
    )
);

Also I have created Renderer file Image.php as below:

namespace YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer;

use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer;
use Magento\Framework\Object;

class Image extends AbstractRenderer
{
/**
* Renders grid column
*
* @param Object $row
* @return  string
*/
public function render(Object $row)
{
$mediaDirectory = $this->_storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
);
return 'testing';
//return '<img src="'.$mediaDirectory.'inquiry/images'.$this->_getValue($row).'"/> width="50"';
}

}

but facing error for renderer. Please find error trace below:

Warning: strpos() expects parameter 1 to be string, object given in E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout\Data\Structure.php on line 68
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'strpos() expect...', 'E:\\xampp\\htdocs...', 68, Array)
#1 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout\Data\Structure.php(68): strpos(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image), '\\Block\\')
#2 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout\Data\Structure.php(54): Magento\Framework\View\Layout\Data\Structure->_generateAnonymousName(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image))
#3 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(721): Magento\Framework\View\Layout\Data\Structure->createStructuralElement('', 'block', Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image))
#4 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(349): Magento\Framework\View\Layout->createBlock(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image), '', Array)
#5 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\Block\Widget\Grid\Column.php(413): Magento\Framework\View\Layout\Interceptor->createBlock(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image))
#6 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\Block\Widget\Grid\Column.php(174): Magento\Backend\Block\Widget\Grid\Column->getRenderer()
#7 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\grid\extended.phtml(148): Magento\Backend\Block\Widget\Grid\Column->getHeaderHtml()
#8 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(59): include('E:\\xampp\\htdocs...')
#9 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid), 'E:/xampp/htdocs...', Array)
#10 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\Template.php(275): Magento\Framework\View\Element\Template->fetchView('E:/xampp/htdocs...')
#11 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\Block\Template.php(104): Magento\Framework\View\Element\Template->_toHtml()
#12 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(652): Magento\Backend\Block\Template->_toHtml()
#13 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(521): Magento\Framework\View\Element\AbstractBlock->toHtml()
#14 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(497): Magento\Framework\View\Layout->_renderBlock('adminhtml_inqui...')
#15 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('adminhtml_inqui...')
#16 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('adminhtml_inqui...')
#17 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('adminhtml_inqui...', true)
#18 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(492): Magento\Framework\View\Layout\Interceptor->renderElement('adminhtml_inqui...', true)
#19 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\Block\Widget\Grid\Container.php(118): Magento\Framework\View\Element\AbstractBlock->getChildHtml('grid')
#20 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\grid\container.phtml(13): Magento\Backend\Block\Widget\Grid\Container->getGridHtml()
#21 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(59): include('E:\\xampp\\htdocs...')
#22 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(YourVendor\YourModule\Block\Adminhtml\Inquiry), 'E:/xampp/htdocs...', Array)
#23 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\Template.php(275): Magento\Framework\View\Element\Template->fetchView('E:/xampp/htdocs...')
#24 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\Block\Template.php(104): Magento\Framework\View\Element\Template->_toHtml()
#25 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(652): Magento\Backend\Block\Template->_toHtml()
#26 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(521): Magento\Framework\View\Element\AbstractBlock->toHtml()
#27 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(497): Magento\Framework\View\Layout->_renderBlock('items_list')
#28 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('items_list')
#29 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('items_list')
#30 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('items_list', true)
#31 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('items_list')
#32 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('content')
#33 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('content')
#34 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('content')
#35 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('content', true)
#36 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('content')
#37 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('main.col')
#38 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('main.col')
#39 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('main.col')
#40 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('main.col', true)
#41 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('main.col')
#42 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('admin.scope.col...')
#43 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('admin.scope.col...')
#44 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('admin.scope.col...')
#45 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('admin.scope.col...', true)
#46 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('admin.scope.col...')
#47 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('page.main.conta...')
#48 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.main.conta...')
#49 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.conta...')
#50 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.main.conta...', true)
#51 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('page.main.conta...')
#52 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('page.content')
#53 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.content')
#54 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content')
#55 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.content', true)
#56 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('page.content')
#57 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#58 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#59 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#60 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#61 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#62 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('backend.page')
#63 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('backend.page')
#64 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page')
#65 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('backend.page', true)
#66 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(548): Magento\Framework\View\Layout\Interceptor->renderElement('backend.page')
#67 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(499): Magento\Framework\View\Layout->_renderContainer('root')
#68 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#69 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(473): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#70 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#71 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Layout.php(917): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#72 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\View\Layout\Interceptor.php(492): Magento\Framework\View\Layout->getOutput()
#73 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Result\Page.php(241): Magento\Framework\View\Layout\Interceptor->getOutput()
#74 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\View\Result\Layout.php(162): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#75 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Backend\Model\View\Result\Page\Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#76 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\View.php(221): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#77 E:\xampp\htdocs\magento\magento2\app\code\YourVendor\YourModule\Controller\Adminhtml\Manage\Index.php(53): Magento\Framework\App\View->renderLayout()
#78 E:\xampp\htdocs\magento\magento2\var\generation\YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor.php(24): YourVendor\YourModule\Controller\Adminhtml\Manage\Index->execute()
#79 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\Action\Action.php(102): YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor->execute()
#80 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\App\AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#81 [internal function]: Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#82 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(74): call_user_func_array(Array, Array)
#83 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(70): YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor->___callParent('dispatch', Array)
#84 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('YourVendor\\Inquiry\\Co...', 'dispatch', Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Array, 'adminAuthentica...')
#85 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\App\Action\Plugin\Authentication.php(135): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#86 [internal function]: Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#87 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#88 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('YourVendor\\Inquiry\\Co...', 'dispatch', Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Array, 'designLoader')
#89 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\Action\Plugin\Design.php(39): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#90 [internal function]: Magento\Framework\App\Action\Plugin\Design->aroundDispatch(Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#91 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#92 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('YourVendor\\Inquiry\\Co...', 'dispatch', Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Array, 'adminMassaction...')
#93 E:\xampp\htdocs\magento\magento2\app\code\Magento\Backend\App\Action\Plugin\MassactionKey.php(33): YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#94 [internal function]: Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#95 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(141): call_user_func_array(Array, Array)
#96 E:\xampp\htdocs\magento\magento2\var\generation\YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor.php(39): YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#97 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\FrontController.php(45): YourVendor\YourModule\Controller\Adminhtml\Manage\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#98 [internal function]: Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#99 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(74): call_user_func_array(Array, Array)
#100 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Chain\Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#101 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#102 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Module\Plugin\DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#103 [internal function]: Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#104 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\Interception\Interceptor.php(141): call_user_func_array(Array, Array)
#105 E:\xampp\htdocs\magento\magento2\var\generation\Magento\Framework\App\FrontController\Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#106 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\Http.php(115): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#107 E:\xampp\htdocs\magento\magento2\lib\internal\Magento\Framework\App\Bootstrap.php(257): Magento\Framework\App\Http->launch()
#108 E:\xampp\htdocs\magento\magento2\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#109 {main}
6

Finally, I have solution for my question.
I have added a grid column with renderer block name as parameter.

$this->addColumn(
    'image',
    array(
        'header' => __('Image'),
        'index' => 'image',
        'renderer'  => '\YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer\Image',
    )
);

Then I have added created a renderer block as below:

namespace YourVendor\YourModule\Block\Adminhtml\Inquiry\Grid\Renderer;

use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer;
use Magento\Framework\Object;
use Magento\Store\Model\StoreManagerInterface;

class Image extends AbstractRenderer
{
    private $_storeManager;
    /**
     * @param \Magento\Backend\Block\Context $context
     * @param array $data
     */
    public function __construct(\Magento\Backend\Block\Context $context, StoreManagerInterface $storemanager, array $data = [])
    {
        $this->_storeManager = $storemanager;
        parent::__construct($context, $data);
        $this->_authorization = $context->getAuthorization();
    }
    /**
     * Renders grid column
     *
     * @param Object $row
     * @return  string
     */
    public function render(Object $row)
    {
        $mediaDirectory = $this->_storeManager->getStore()->getBaseUrl(
            \Magento\Framework\UrlInterface::URL_TYPE_MEDIA
        );
        $imageUrl = $mediaDirectory.'/inquiry/images'.$this->_getValue($row);
        return '<img src="'.$imageUrl.'" width="50"/>';
    }
}

And It is working!!

  • can you tell me about add/edit action with image field. i have same problem when i have save or edit record. so what should be action for that. – Suresh Chikani Oct 14 '15 at 6:51
  • I also recently wrote an article on how to do this when you're building your admin grid from XML layout: gielberkers.com/… – Giel Berkers Apr 8 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.