I have server-side datatable in which I'm trying to show images in showimage
column.
I tried to change code for rendering column using this post which is as below but no images are displayed in table:
Server_processing.php:
$columns = array(
array( 'db' => 'first_name', 'dt' => 0 ),
array( 'db' => 'last_name', 'dt' => 1 ),
array( 'db' => 'position', 'dt' => 2 ),
array( 'db' => 'office', 'dt' => 3 ),
array(
'db' => 'showimage',
'dt' => 4,
'formatter' => function( $d, $row ) {
return '<img src="$d" style="height:50px;width:50px;"/>';
}
),
array(
'db' => 'salary',
'dt' => 6,
'formatter' => function( $d, $row ) {
return '$'.number_format($d);
}
)
);
With above code, in src
image path is not displayed as a result image is not displayed.
It is showing when go thru source code as src="$d"
Mysql database: Mysql database
I have placed images at both places where .html resides and in images
folder.