about show the image in the grig

Questionsabout show the image in the grig
Chao Shun Jenq asked 11 years ago

when we use:

$col["default"] = "<a href='$upload_url/{note}' target='_blank'><img height=100 src='$upload_url/{note}'></a>";

if the field "note" is empty,
and then we click the image link,
it will appear the content of directory

how to prevent it?

Regard,

4 Answers
Chao Shun Jenq answered 11 years ago

correct above:
$col["default"] = "<a href='$upload_url/{note}' target='_blank'>view image</a>";

Abu Ghufran answered 11 years ago

Hello,

You can use conditional data in cell, for e.g.

$blank = "<a href='$upload_url/no_image.jpg' target='_blank'><img height=100 src='$upload_url/no_image.jpg'></a>";

$withimage = "<a href='$upload_url/{note}' target='_blank'><img height=100 src='$upload_url/{note}'></a>";

$col["condition"] = array('$row["note"] == ""', $blank , $withimage);
$cols[] = $col;

C3media answered 11 years ago

Hi,

I'm trying to put imagen file on the Grid, but has been impossible.

It´s showing filename.jpg on column, but image no show…

Thanks by your recommendations, regards!

Abu Ghufran answered 11 years ago

Refer these settings:

Demo: demos/apperence/image.php

# Custom made column to show link, must have default value as it's not db driven
$col = array();
$col["title"] = "Logo";
$col["name"] = "logo";
$col["width"] = "80";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
$col["export"] = false;

// you can also write:
// $col["default"] = "<img height=50 src='http://domain.com/images/{custom_image}'>";
// where custom_image in defined column of grid with filename to show as image (e.g. logo_default.png)

$col["default"] = "<img height=50 src='http://ssl.gstatic.com/ui/v1/icons/mail/logo_default.png'>&quot;;

$cols[] = $col;

Your Answer

19 + 1 =

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?