Hi Abu,
Love the product and I just wanted to share some code. I had previously implemented displaying icons in the grid for uploaded files which worked well. I have now enabled the multiple file upload option and wanted to maintain the icon display feature, only this time display 1 icon per uploaded file. Here's the solution I came up with adding another array to your original solution:
function display_icon($data)
{
$filelist = $data["attachment"];
$filearray = explode(",",$filelist);
$filecount = count($filearray);
$result = "";
for($x=0; $x <= $filecount; $x++){
$file = $filearray[$x];
$arr = explode(".",$file);
$ext = $arr[count($arr)-1];
if (empty($file))
$result .= "";
else if (strtolower($ext) == "pdf")
$result .= "<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file#page=1&zoom=75','Title','width=800,height=900')">
<img height=30 src=http://192.168.1.20/intranet/phpgridfull/iconpdf.jpg></a>";
else if (strtolower($ext) == "doc" || strtolower($ext) == "docx")
$result .= "<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file','Title','width=800,height=900')">
<img height=30 src=http://192.168.1.20/intranet/phpgridfull/iconword.png></a>";
else if (strtolower($ext) == "xls" || strtolower($ext) == "xlsx")
$result .= "<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file','Title','width=800,height=900')">
<img height=30 src=http://192.168.1.20/intranet/phpgridfull/iconexcel.png></a>";
else if (strtolower($ext) == "png" || strtolower($ext) == "jpg" || strtolower($ext) == "jpeg")
$result .= "<span style='height:30px;width:30px;'><a class='fancybox' href='http://192.168.1.20/intranet/phpgridfull$upload_url/$file' target='_blank'><img style='max-width:100%;max-height:100%;width:auto;height:auto;position:relative;top:50%;transform:translateY(-50%);' src='http://192.168.1.20/intranet/phpgridfull$upload_url/$file'></a></span>";
else if (strtolower($ext) == "tif")
$result .= "<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file','Title','width=800,height=900')">
<img height=30 src=http://192.168.1.20/intranet/phpgridfull/tif.gif></a>";
else
$result .= "<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file','Title','width=800,height=900')">
<img height=30 src='http://192.168.1.20/intranet/phpgridfull/iconunknown.png'>$file</a>";
}
return $result;
}
I've had to change the href links using this new method as the popup windows weren't working.
For PDF;
<a href="javascript:window.open('http://192.168.1.20/intranet/phpgridfull$upload_url/$file#page=1&zoom=75','Title','width=800,height=900')">
For PNG, JPG, JPEG:
<a class='fancybox' href='http://192.168.1.20/intranet/phpgridfull$upload_url/$file' target='_blank'><img style='max-width:100%;max-height:100%;width:auto;height:auto;position:relative;top:50%;transform:translateY(-50%);' src='http://192.168.1.20/intranet/phpgridfull$upload_url/$file'>
Everything else:
<a href="http://192.168.1.20/intranet/phpgridfull$upload_url/$file">