How to use images for contacts

Dear community,

Is there a way to show images (portraits) of contacts in SuiteCRM?

Thanks in advance
Best Regards
H

1 Like

Hi there,

If you are the Administrator of the system navigate to Admin > Studio.

When the Studio page loads navigate to the Contacts module within the Module tree and expand the tree to show Labels, Fields, Relationships, Layouts and Subpanels. Expand further the ‘Layouts’ folder and click on the EditView.

This will load the current fields that are available to users when they Edit the record. Within the toolbox area there should be a ‘Photo’ field available as default.

To make this field display on your EditView layout, first you must find space for it if there is not one already available. If there are no empty spaces on the layout already i.e. a box that says ‘(filler)’ then drag and drop a ‘new panel’ onto the layout. It should gird lock into place on your layout. Once you have a panel (which then provides you with two ‘(filler)’ spaces) you can then drag and drop the Photo field into one of those spaces.

If you had a space already available then simply drag and drop the Photo field into that box.

Once you are happy with the layout click ‘Save & Deploy’

Then test your new layout by navigating to a Contact record in EditView, and there you will have a ‘browse’ image field named as ‘Photo’.

To show the uploaded image on the DetailView, repeat the above steps but instead of the EditView you will navigate to the Detail View and add the ‘Photo’ field to that layout. Remember to Save & Deploy when happy.

Hope this helps.

3 Likes

Thanks! This was great! Immediate, easy to follow and working :slight_smile:
How can I adjust the image size on the contact page? Currently it is about 30px in height. Only “Save as” gives me the real size of the image. A reasonably identifyable size would be great.

Thanks again in advance
Best Regards
H

No problem.

This part you will need to have access to the files for this alteration.

First, set the width and height of the image field via the Studio section (again navigate to Admin > Studio > Contacts (Module)). This time click on the ‘Field’ link within the Contacts module’s tree. This will list all the currently available fields for that module. Click again on ‘Photo’ and it will display attributes of that field e.g. Datatype, Border, Height, Width etc.

The default is 160 x 160 pixels… However, the template is not showing as expected (It displays the image on the DetailView very small). This is because the template of the Contact’s DetailView has restricted the image (We’ve raised a bug for this)

If you have access to the system files look for a file called ‘DetailView.tpl’ within your SuiteCRM folder include/SugarFields/Fields/Image

Replace:

height="50"

With:

height="{if !$vardef.height}{{$vardef.height}}{else}50{/if}"

After this, save that file (re-upload if required) and do a Quick Repair & Rebuild of the CRM to overwrite the old DetailView template (Navigate to Admin > Repair > Quick Repair & Rebuild).

Once the Quick Repair & Rebuild has been successful navigate back to your Contact’s DetailView that has a photo and it should be larger!

Hope this helps.

1 Like

Thanks again.

This one seems to be a bit more tricky.
I followed your advice until “Click again on ‘Photo’” which created the followin error message popup:

undefined
Warning: Creating default object from empty value in /www/htdocs/user/domain/modules/ModuleBuilder/views/view.modulefield.php on line 154
{“east”:{“title”:“Edit Field”,“crumb”:"",“content”:"
</div>\n\n

The “undefined” label is already subject to a different thread: https://suitecrm.com/forum/suitecrm-7-0-discussion/7070-undefined-labels-all-over-the-place#25527

Maybe the content is also due to access rights issues?

Thanks in advance
Best Regards
H

Try creating a new field of the type ‘Image’ in your module via Studio. Can you set the image height/width there?

See if the issue is with that particular ‘Photo’ field.

P.S. You may not need to adjust the height/width through Studio if you don’t require it. The Default height and width are 160px. You could skip that step and just adjust the template and Repair & Rebuild.

Clicking “Add field” in Studio in the Contacts module leads to the same error message:

undfined
Warning: Creating default object from empty value in /www/htdocs/w011f7da/crm.tomspike.com/modules/ModuleBuilder/views/view.modulefield.php on line 154
{“east”:{“title”:“Edit Field”,“crumb”:"",“content”:"
</div>\n\n

Thanks in advance
Best Regards
H

Hi,

I managed to fix the “undefined” labels.
The error message remains when I try to display attributes of the “photo” or any other field. Als trying to add a new field brings up the following error message:

An error has occured
Warning: Creating default object from empty value in /www/htdocs/user/domain/modules/ModuleBuilder/views/view.modulefield.php on line 154
{“east”:{“title”:“Edit Field”,“crumb”:"",“content”:"
</div>\n\n

Thanks in advance
Best Regards
H

The information in this topic is very helpful, thanks!

I got the pictures to work in edit view and detail view.

Now I’m trying to add them to a subpanel list, but I can’t see the “photo” field in Studio when editing the subpanels… is there a way to get the photos (as small thumbnails) on those subpanels?

Thanks in advance!

PGR, were you able to add the photos to the subpanel? I’d like to know how. Thanks!

Hi

you’ll find everything you need to know here:

https://github.com/salesagility/SuiteCRM/issues/1305

By the way, that issue is already fixed in a Pull Request, but unfortunately it hasn’t been merged yet. It will come out in a future version at some point, I hope…

Hi,

I just installe SuiteCRM 7.11 on Ubuntu 18.04. Searching for instructions on how to add a picture to the contact, i found your most helpful description. I found the empty field to the right of the description field in the contacts layout and added the photo element there. Then in Editor mode I could add an image to a contact.
When switching to display mode, however, there is no image displayed. What went wrong?

I checked the html source code for both modes. In display mode, the field for displaying the photo is completely empty. Did I forgot something?

The source code for both modes:

================
source code edit mode

Beschreibung:
Foto:

================
source code view mode

Beschreibung:

I would appreciate any help, many thanks in advance

Günter

Problem solved!
I did not notice that two layouts had to be changed. After I changed the layout for the detail view, everything is fine.

Regards

Günter