Photos as thumbnails in subanels

Hi. I’m using the SuiteCRM Photo field (not the famous add-on) with my Contacts.

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 through code?

Thanks in advance!

This is actually very simple, I just added the field to a subpanel manually, for example in file
custom/modules/Contacts/metadata/subpanels/ForAccounts.php

Add a block like this

		'photo' =>array (
				'name' => 'photo',
				'vname' => 'LBL_PHOTO',
				'width' => '6%',
				'default' => true,
		),

…and adjust the widths of the other fields to keep the sum under 100%.

I did run into a problem that might be a bug… when the HTML gets rendered, the photo wasn’t showing, but I could see the photo id there, only something wasn’t quite right. After checking I realized there’s a Smarty query in the ListView.tpl file that isn’t working.

So I customized that file by creating custom/include/SugarFields/Fields/Image/ListView.tpl and adjusting the layout to be like this:

<img id="{$col|lower}" pgr="was here" src="index.php?entryPoint=download&id={sugar_fetch object=$parentFieldArray key='ID'}_{$col|lower}&type=Contacts" style="max-width: 200px;" height="50">

The original code that is NOT working (at least for me) goes like this:

<img id="{$col|lower}" src="index.php?entryPoint=download&id={sugar_fetch object=$parentFieldArray key='ID'}_{$col|lower}&type={sugar_fetch object=$vardef key="custom_module"}" style="max-width: 200px;" height="50">

but for some reason that “fetch” isn’t returning “Contacts” like it should, it just returns blank so the URL isn’t rendered correctly…

Can somebody check if this is working for you, or if it is a bug? My solution hard-codes the module name, it will be problematic for people using photos from more than one module.

BTW: this is a pretty neat feature that really makes the program more attractive, I had a list of contacts and I had photos for all of them, importing everything looks great!

@pgr, I realize this message is quite old. But I was trying to figure out how I can show images in the history sections.

My system does not have a file you mentioned in this post.

Is it possible to display images as small thumbnails?

Tony

Do you mean include/SugarFields/Fields/Image/ListView.tpl ?

I had a missing slash in the file path, I edited it now.

Yes, I was wanting to get this to work in the History Subpanel. Not sure if this could/would work
Would also like to get this to work in the Notes List view as I know someone is going to ask me to make that work.

If you have any suggestions I would love to hear that.

Sorry, I don’t understand exactly where you’re stuck now. Did you find the file (after my edit correcting the file name), did you try to make the changes I proposed? What exactly went wrong?

Hello ,
I have try this in suitecrm/custom/modules/AOS_Invoices/metadata/subpanels/Contact_subpanel_contact_aos_invoices.php

),
  'billing_account' => 
  array (
    'width' => '10%',
    'vname' => 'LBL_BILLING_ACCOUNT',
    'default' => true,
    'widget_class' => 'SubPanelDetailViewLink'
  ),
  'billing_account_logo_cie_c' => 
     array (
      'type' => 'image',
      'default' => true,
      'studio' => 'visible',
      'width' => '10%',
      'vname' => 'LBL_BILLING_ACCOUNT_LOGO_CIE',
      'label' => 'Logo',
      ),

and created a /custom/include/SugarFields/Fields/Image/ListView.tpl with this :
<img id="{$col|lower}" pgr="was here" src="index.php?entryPoint=download&id={sugar_fetch object=$parentFieldArray key='ID'}_{$col|lower}&type=Accounts" style="max-width: 200px;" height="50">

and add custom/modules/Accounts/metadata/subpanels/default.php
with

subpanel_layout = array(
    'top_buttons' => array(
        array('widget_class' => 'SubPanelTopCreateButton'),
        array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'Accounts'),
    ),

    'where' => '',
    
    'list_fields' => array(
      'name' =>
      array(
        'vname' => 'LBL_LIST_ACCOUNT_NAME',
        'widget_class' => 'SubPanelDetailViewLink',
        'width' => '45%',
        'default' => true,
      ),
      'LOGO_CIE_C' => 
     array (
      'type' => 'image',
      'default' => true,
      'studio' => 'visible',
      'width' => '10%',
      'label' => 'LBL_LOGO_CIE',
      ),
      'billing_address_city' =>
      array(
        'vname' => 'LBL_LIST_CITY',
        'width' => '20%',
        'default' => true,
      ),
      'billing_address_country' =>
      array(
        'type' => 'varchar',
        'vname' => 'LBL_BILLING_ADDRESS_COUNTRY',
        'width' => '7%',
        'default' => true,
      ),
      'phone_office' =>
      array(
        'vname' => 'LBL_LIST_PHONE',
        'width' => '20%',
        'default' => true,
      ),
      'edit_button' =>
      array(
        'vname' => 'LBL_EDIT_BUTTON',
        'widget_class' => 'SubPanelEditButton',
        'width' => '4%',
        'default' => true,
      ),
      'remove_button' =>
      array(
        'vname' => 'LBL_REMOVE',
        'widget_class' => 'SubPanelRemoveButtonAccount',
        'width' => '4%',
        'default' => true,
      ),
   )
);

But nothing… Have an Idea
Quentin