Image colum not showing

QuestionsImage colum not showing
jiga1up asked 6 years ago

Hi im creating a grid that displays some colums, but when I try to display logo_picture colum from database, colum doesnt display in grid, the only way that colum displays is if I erased it from custom select query, then I would like to display image uploaded in grid.
include_once(“conexion_grid.php”);
// include and create object
//include_once(“lib/inc/adodb/adodb.inc.php”);
include_once(“lib/inc/jqgrid_dist.php”);
$db_conf = array(
“type” => “mysqli”,
“server” => localhost,
“user” => “buho3448_desarro”,
“password” => “xxxx”,
“database” => “buho3448_econ”
);
$g = new jqgrid($db_conf);
$col = array();
$col[“title”] = “ID”;
$col[“name”] = “id”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = false;
$col[“hidden”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “LOGO”;
$col[“name”] = “logo_picture”;
$col[“width”] = “50”;
$col[“editable”] = true;
$col[“edittype”] = “file”; // render as file
$col[“upload_dir”] = “temp”; // upload here
$col[“show”] = array(“list”=>false,”edit”=>true,”add”=>true); // only show in add/edit dialog
$cols[] = $col;
// virtual column to display uploaded file in grid
$col = array();
$col[“title”] = “FOTO”;
$col[“name”] = “logo”;
$col[“width”] = “15”;
$col[“editable”] = false;
$col[“default”] = “<a href='{logo_picture}’ target=’_blank’><img height=60 src='{logo_picture}’></a>”;
$col[“show”] = array(“list”=>true,”edit”=>false,”add”=>false); // only show in listing
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-calendar’></i> PERIODO”;
$col[“name”] = “numero_de_periodo”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-pencil-alt’></i> NOMBRE”;
$col[“name”] = “nombre”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-building’></i> EMBRESA”;
$col[“name”] = “empresa”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-pencil-alt’></i> SLOGAN”;
$col[“name”] = “slogan”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-envelope’></i> EMAIL”;
$col[“name”] = “email”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “<i class=’fas fa-key’></i> CONTRASEÑA”;
$col[“name”] = “clave”;
$col[“width”] = “40”;
$col[“align”] = “center”;
$col[“editable”] = true;
$col[“resizable”] = true;
$cols[] = $col;

$grid[“rowList”] = array(10,20,30,40,50,’All’);
$grid[“autowidth”] = false;
$grid[“sortable”] = true;
$grid[“rowNum”] = 16;
$grid[“rownumbers”] = true;
$grid[“rownumWidth”] = 30;
$grid[“forceFit”] = true;
$grid[“shrinkToFit”] = true;
$grid[“resizable”] = true;
$grid[“autoresize”] = true;
$grid[“multiselect”] = true;
$grid[“altRows”] = true;
$grid[“cellEdit”] = true;
$grid[“reloadedit”] = true;
$grid[“caption”] = “<i class=’fas fa-users’></i> CONTROL ESCOLAR – USUARIOS”;
$grid[“loadtext”] = “<i class=’fa fa-spinner fa-2x fa-spin’></i> Buscando coindicencias …”;
$grid[“sortname”] = ‘id’; //TEN CUIDADO CON ESTOS TE PUEDEN CAUSAR PROBLEMAS EN LAS CONSULTAS
$grid[“sortorder”] = “desc”;
$grid[“add_options”][“jqModal”] = true;
$grid[“add_options”][“modal”] = true;
$grid[“edit_options”][“jqModal”] = true;
$grid[“edit_options”][“modal”] = true;
$grid[“edit_options”][“checkOnSubmit”] = true;
$grid[“add_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro agregado exitosamente”;
$grid[“edit_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro modificado exitosamente”;
$grid[“delete_options”][“success_msg”] = “<i class=’fa fa-check’></i> Registro eliminado exitosamente”;
$g->set_actions(array(“add”=>true,”edit”=>true,”delete”=>true,”view”=>true,));
$g->set_options($grid);
$g->select_command = “SELECT id,logo_picture,numero_de_periodo,
nombre,empresa,slogan,email,clave
FROM buho3448_econ.usuarios”;
$g->table = “buho3448_econ.usuarios”;
$g->set_columns($cols,true);
$out = $g->render(“list1”);

1 Answers
Abu Ghufran Staff answered 6 years ago

If your column “logo_picture” contains URL of the image, then most likely it is not found with respect to current path of code file. You can check browser console (F12) and see network tab for 404 error and correct img src path accordingly.
 
If this column have binary data, then it will not be displayed as grid does not support binary data display directly.
Alternate way, You can refer demos/file-upload-blob.php for reference.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

1 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?