CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Theme a contact image
Pages: [1]

Author Topic: Theme a contact image  (Read 1797 times)

adshill

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 8
Theme a contact image
August 19, 2009, 07:39:43 pm
I followed these instructions: http://forum.civicrm.org/index.php/topic,40.0.html

to add a photo to my contacts. However the 100px by 100px forcing of the image is not a very beautiful way of presenting it.

What is the best way to theme an image which has been added using custom fields? I would like to have it in the top right of a contact view page making a more "Profile" view, rather than being stuck down at the bottom of the contact.

Also, is there anyway to make a default image appear if one is not available?

Thanks a lot! Adam

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Theme a contact image
August 20, 2009, 05:08:35 am

a patch to scale the image better would be great and highly appreciated. A few folks have commented on that, but has not been important enought for a patch to be contributed :(. The code for that is localized in 2 places i think

Your best bet would be to customize the template and place the image where you want it, check:

http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in,+Profile,+Contribution+and+Event+Registration+Screens

your customized template can put a default image if one does not exist

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

adshill

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 8
Re: Theme a contact image
August 21, 2009, 01:21:18 am
Hi Lobo,

Thanks a lot, I'm just not completely sure how I should be pulling custom fields out of database and into themes. My theming of existing fields has been fine and works well but I can't seem to pull custom fields out.

Also the 100px x 100px size seems to be hardcoded into the image rather than styled so I don't see where that is being added to the image tag.

Thanks,

Adam

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Theme a contact image
August 21, 2009, 05:17:55 am

1. for the custom data on civicrm view screen, the values are stored in 'viewCustomData'. You can also pull them out in a pageRun hook and reformat it and assign another smarty variable to make it easier in the template

2. the two files where we set the image size to 100x100 are:

templates/CRM/Custom/Page/CustomDataView.tpl
CRM/Core/BAO/CustomField.php

Ideally we should have the same ratio as the original image to make it look decent. Would be great of your team could submit an issue and file a patch for this (should be fairly easy)

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

adshill

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 8
Re: Theme a contact image
August 27, 2009, 11:08:18 am
Hi Lobo,

We're looking to have a patch for this soon we hope. We'll patch it so that it handles image resizing and then allow others to theme it as they choose. Will let you know once I have more info.

Thanks,

Adam

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Theme a contact image
August 27, 2009, 11:09:32 am

cool. ask your developers to ping us on IRC if they need any help / clarification / guidance :)

much appreciated that u'll are doing this

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

dwatts3624

  • Guest
Re: Theme a contact image
October 16, 2010, 07:06:45 pm
Adam, was any progress ever made on this solution?  I have been working on custom profile pages and displaying large images is a requirement I was hoping to meet.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Theme a contact image

This forum was archived on 2017-11-26.