4

I have made a copy of my civicrm instance i.e from http://www.example.com/example to http://www.example.com/example1 and when viewing a contact, the contact's image url is still pointing to the old sub domain http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg

which causes long response time to view a contact and also i get a warning (Warning: getimagesize(http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg): failed to open stream: Connection timed out in CRM_Contact_Page_View->preProcess() (line 170 of /var/www/example1/sites/all/modules/civicrm/CRM/Contact/Page/View.php)

resource urls and directories have been updated, i'm on version 4.5.5

Note that this is not the case on http://www.example.com/example/

2

The schema for contact records specifies that the image be stored as URL (civicrm_contact.image_URL).

As an historical matter, I don't know why this was chosen, but it does come with some trade-offs:

  • If you write a UI in a different PHP stack, it's easier to share image uploads if they're URLs. For example, webform_civicrm accepts uploads using Drupal/webform techniques and then simply sets the URL.
  • If you have a complex site that spans multiple domains, the contact images can be shared. Similarly, if you're migrating into Civi, you can import the URLs without rearranging the image files.
  • It's trivial to include the image URL as a mail-merge token.
  • If you migrate the Civi site to a different URL, the contact images break.
  • If you access via APIv3, it's can be awkward to manage image data.

To fix contact images after migrating to a different URL, use SQL to perform a search/replace on field image_URL of table civicrm_contact. For tips on composing a search/replace, see, e.g., https://stackoverflow.com/questions/1876762/mysql-way-to-update-portion-of-a-string

1

Some of the performance problems are related to how the image url is resolved via the API. For a good discussion see here: https://forum.civicrm.org/index.php?topic=34929.0

Chris does a performance analysis : http://www.webpagetest.org/result/150121_M9_AX6/1/details/

One solution is to use the CMS for images and I found drupal handling / imagecache to be better for event images.

0

Whenever you move one instance to another please make sure you follow the below steps

http://wiki.civicrm.org:8090/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location

delete all the cache and rebuild the menu that should work correctly

  • these steps have been followed, note that this happens only to contacts with images. thanks – Kboy Aug 21 '15 at 10:45
  • then in civicrm their is an table called civicrm_file please update the file path which hold the old file location change it to new location – Ramesh - ARTECH Consultancy Aug 21 '15 at 11:47
  • Hi Ramesh, don't seem to find the file path in this table. thanks – Kboy Aug 21 '15 at 12:09
  • hi Please look in civicrm_contact Table where you can find an column called img_url please update the path – Ramesh - ARTECH Consultancy Aug 21 '15 at 13:06
  • 1
    Is this a bug? contact's images saved as absolute url makes it difficult to move the site – Kboy Aug 22 '15 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.