Error on open image in page

Hi,

I have a gridview with pjax, which does the listing of images. But when you click on the image to open it, it opens it in the base64 format (everything is encoded on the page).

How to correct?

Viewing the image

7374

PeTZ2.png

[b]https://ibb.co/jxnVo5

[/b]

After clicking

7375

VYu3G.png

https://ibb.co/dGWqo5

page.php




<?php Pjax::begin(['id' => 'pjax-container']) ?>

        	<?= GridView::widget([

        	'dataProvider' => $dataProvider,

        	'emptyText'	=> '</br><p class="text-danger">Nenhum imagem anexada!</p>',

        	'summary'  	=>  '',

        	'showHeader'   => false,

        	'columns' => [

                	[

                	'attribute'=>'img',

                	'format' => 'html',

                	'value'=>function ($data) {

                    	return Html::a(Html::img(\Yii::$app->getModule('client')->params['clientImages'].$data["mod_client_base_id"].'/'.$data["img"],

                     		['width' => '50px', 'class' => 'img-rounded img-responsive']), \Yii::$app->getModule('client')->params['clientImages'].$data["mod_client_base_id"].'/'.$data["img"], ['target' => '_blank']);

                	},                             		

                	'contentOptions'=>['style'=>'width: 70%;text-align:left'],

                	],

                	[

                	'class' => 'yii\grid\ActionColumn',

                	'contentOptions'=>['style'=>'width: 30%;text-align:center'],

                	'controller' => 'images',

                	'template' => ' {delete}',

                	'buttons' => [

                        	'delete' => function ($url) {

                        	return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [

                          	'title' => 'Excluir Imagem',

                          	'class' => 'btn btn-default btn-sm',

                          	'aria-label' => 'Excluir',

                          	'onclick' => "

                              	if (confirm('Tem certeza que deseja excluir?')) {

                                  	$.ajax('$url', {

                                      	type: 'POST'

                                  	}).done(function(data) {

                                      	$.pjax.reload({container: '#pjax-container'});

                                  	});

                              	}

                              	return false;

                          	",

                        	]);

                        	},

                	],

            	],

        	],

        	]); ?>

<?php Pjax::end() ?>



Fix with param


'data-method'=>'post'


[

                	'attribute'=>'img',

                	'format' => 'raw',

                	'value'=>function ($data) {

                  	return Html::a(

                    	Html::img(\Yii::$app->getModule('client')->params['clientImages'].$data["mod_client_base_id"].'/'.$data["img"], ['width' => '50px', 'class' => 'img-rounded img-responsive']), 

                    	\Yii::$app->getModule('client')->params['clientImages'].$data["mod_client_base_id"].'/'.$data["img"], 

                    	['data-method'=>'post','target' => '_blank']);

                	},                               	

                	'contentOptions'=>['style'=>'width: 70%;text-align:left'],

                	],

The IMG tag normally link a file that the browser download and show in the page.

It seem to me that you are trying to embeb it directly in to the HTML.

Altrougth is possible, read the following link for the correct way,

I would avoid that since these images change and this prevent the browser to cache the contents.