You should first refer to this document on how to actually store images/file in xataface.
I used method two because I always find it much easier to manage when the files exist physically and not just as bytes in the database. So let's assume that the picture field in the database is what is storing the file name in the database, and you have a directory called picture in your delegate class.
The next step is to go into your delegate class that represents this record and include this function:
function friend_picture__htmlValue(&$record){
return '<img src="'.$record->display('picture').'"></img>';
}
What this does is define a custom field called friend_picture which will basically return the image. By using $record->display() we are returning the whole address of the picture. Xataface is smart enough to figure out how to return the address.
This is opposed to using $record->val('picture') which would return the raw value of the field in the database which would just be the filename.
And then final step is to go into the fields.ini file of this delegate class and include this:
[friend_picture]
logo = 1
This causes xataface to recognize this was a logo field for the record and then display the picture in the top left hand corner of the detail view of the record.
And volia!
Some things to note is that trying to include the logo = 1 as attribute for the field that holds the filename that's seem to work. For example, say in the fields.ini file you have:
[picture]
logo = 1
This would place this field to the top left hand corner, but it would just say "View Field Content In New Window ()" in the top left hand corner. You have to make a custom field.
Also, you can specify exactly records of which table should display logos by including this line of code in the ApplicationDelegate class' getPreferences() function:
//this is needed to determine which table records will have a logo on them
if ( !in_array($query['-table'], array('companies', 'dealers','news', 'strategies', 'offerings') ) ){
$prefs['hide_record_view_logo'] = 1;
}
What this basically did was check whether the current table viewing this record was either companies, dealer, etc. And if it wasn't, it would turn the hide_record_view_logo preference. So a modified line of code could be like this:
if ( !in_array($query['-table'], array('companies', 'dealers','news', 'strategies, 'offerings') ) ){
$prefs['hide_record_view_logo'] = 1;
}