Forum


18:05

09/11/2009

I have on the server a directory with photos.
I have in my mysql database records with a field 'photo'. the field contains the name of the photo.
I want to populate a grid with these photos with the json method.
I tried this:
while ...
$responce->rows[$i]['id']=$row['Id_Resident'];
$responce->rows[$i]['cell']=array($row['Nom'],$row['Prenom'],$row['Sexe'],"/photos/".$row['Photo']);
$i++;
echo json_encode($responce);
But the result is a link to the photo AND not the photo !
Same result if i do:
formatter:'showlink', formatoptions:{baseLinkUrl:'/photos/'},
02:06

Moderators
08/10/2009

In this case the best idea is to form the HTML of the image tag directly, instead of using formatters (and I believe there is no image formatter currently yet).
So just form the image tag, e.g.
”<img src='/photos/” . $row['Photo']." />"
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
09:20

Moderators
08/10/2009

I am not sure I understand the scenario. What is the problem if the picture is in a directory on the server?
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
09:00

09/11/2009

For those who are looking for the/one solution:
afterInsertRow: function(rowid, aData, rowelem){
$('#' + rowid + ' td:first-child + td + td + td').
html('<img src =' + '”' + aData.photo + '”' +' height=”75″ width=”75″ />');
},
- aData.photo is the path of the photo on the server
- "photo" is the colName
- the photos are stored in the fourth column in my solution
If you have a better and elegant solution, tell me it
Most Users Ever Online: 715
Currently Online:
88 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66