Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
populate photo from a db to a grid
13/11/2009
18:05
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

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/'},

14/11/2009
02:06
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

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

http://www.trirand.net

14/11/2009
04:59
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

No because the directory is on the server !

14/11/2009
09:20
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

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

http://www.trirand.net

14/11/2009
12:21
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

The server is one machine, the clients are thier own machine. You could be one client ! the photo are not in your machine but in my machine.

src='/photos/ : javascript will search for this folder on your machine !

16/11/2009
08:32
Avatar
markw65
Member
Members
Forum Posts: 179
Member Since:
30/07/2009
sp_UserOfflineSmall Offline

src='/photos/ : javascript will search for this folder on your machine !


No, it wont. Try it.

Mark

16/11/2009
16:15
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

You are right: I should test ...

But, but I have in the cell the path to the photo and not the photo itself !

25/11/2009
09:00
Avatar
phicarre
Member
Members
Forum Posts: 132
Member Since:
09/11/2009
sp_UserOfflineSmall Offline

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 Smile

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information