Answers.Body: <p>The schema for contact records specifies that the image be stored as URL (<code>civicrm_contact.image_URL</code>).</p>
  
  <p>As an historical matter, I don't know why this was chosen, but it does come with some trade-offs:</p>
  
  <ul>
  <li>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.</li>
  <li>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.</li>
  <li>It's trivial to include the image URL as a mail-merge token.</li>
  <li>If you migrate the Civi site to a different URL, the contact images break.</li>
  <li>If you access via APIv3, it's can be awkward to manage image data.</li>
  </ul>
  
  <p>To fix contact images after migrating to a different URL, use SQL to perform a search/replace on field <code>image_URL</code> of table <code>civicrm_contact</code>. For tips on composing a search/replace, see, e.g., <a href="https://stackoverflow.com/questions/1876762/mysql-way-to-update-portion-of-a-string">https://stackoverflow.com/questions/1876762/mysql-way-to-update-portion-of-a-string</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-23T17:31:56.683Z
Answers.LastActivityDate: 2015-08-23T17:31:56.683Z
Answers.LastEditDate: 2017-05-23T12:38:59.763Z
Answers.UserDisplayName: Tim Otten
Answers.Body: <p>Some of the performance problems are related to how the image url is resolved via the API.  For a good discussion see here: <a href="https://forum.civicrm.org/index.php?topic=34929.0" rel="nofollow">https://forum.civicrm.org/index.php?topic=34929.0</a></p>
  
  <p>Chris does a performance analysis : <a href="http://www.webpagetest.org/result/150121_M9_AX6/1/details/" rel="nofollow">http://www.webpagetest.org/result/150121_M9_AX6/1/details/</a></p>
  
  <p>One solution is to use the CMS for images and I found drupal handling / imagecache to be better for event images.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-23T18:00:31.757Z
Answers.LastActivityDate: 2015-08-23T18:00:31.757Z
Answers.UserDisplayName: Sonicthoughts
Answers.Body: <p>Whenever you move one instance to another please make sure you follow the below steps </p>
  
  <p><a href="http://wiki.civicrm.org:8090/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location" rel="nofollow">http://wiki.civicrm.org:8090/confluence/display/CRMDOC/Moving+an+Existing+Installation+to+a+New+Server+or+Location</a></p>
  
  <p>delete all the cache and rebuild the menu that should work correctly </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T10:45:25.657Z
Answers.Text: these steps have been followed, note that this happens only to contacts with images. thanks
Answers.UserDisplayName: Kboy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T11:47:42.987Z
Answers.Text: 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
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T12:09:49.740Z
Answers.Text: Hi Ramesh, don't seem to find the file path in this table. thanks
Answers.UserDisplayName: Kboy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T13:06:58.910Z
Answers.Text: hi Please look in civicrm_contact Table where you can find an column called img_url please update the path
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T13:37:58.813Z
Answers.Text: Hi, i can see that the urls are not updated in the database but changing them to the current sub domain won't work either, have just tested by replacing the old sub domain with the new sub domain and got this error message:the image "http://www.example.com/example1/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9" cannot be displayed because it contains errors
Answers.UserDisplayName: Kboy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-22T22:26:13.263Z
Answers.Text: Is this a bug? contact's images saved as absolute url makes it difficult to move the site
Answers.UserDisplayName: Kboy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T10:25:02.910Z
Answers.LastActivityDate: 2015-08-21T10:25:02.910Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>I have made a copy of my civicrm instance i.e from <a href="http://www.example.com/example" rel="nofollow">http://www.example.com/example</a> to <a href="http://www.example.com/example1" rel="nofollow">http://www.example.com/example1</a> and when viewing a contact, the contact's image url is still pointing to the old sub domain <a href="http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg" rel="nofollow">http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg</a> </p>
  
  <p>which causes long response time to view a contact and also i get a warning (Warning: getimagesize(<a href="http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg" rel="nofollow">http://www.example.com/example/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9.jpg</a>): 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)</p>
  
  <p>resource urls and directories have been updated, i'm on version 4.5.5</p>
  
  <p>Note that this is not the case on <a href="http://www.example.com/example/" rel="nofollow">http://www.example.com/example/</a></p>
  
Tags: <contacts><contact-image>
Title: why are contacts images stored as absolute URLs?
ThreadText: # why are contacts images stored as absolute URLs?
  
  (Asked by: username_0 on 2015-08-21)
  
  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/>
  
  **Tags:** contacts, contact-image
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2015-08-23. Score: 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>
  
  
  ---
  
  ### Answer by username_2 on 2015-08-23. Score: 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.
  
  
  ---
  
  ### Answer by username_3 on 2015-08-21. Score: 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
  
  > **Comments:**
  > **username_0**: these steps have been followed, note that this happens only to contacts with images. thanks  
  > **username_3**: 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  
  > **username_0**: Hi Ramesh, don't seem to find the file path in this table. thanks  
  > **username_3**: hi Please look in civicrm_contact Table where you can find an column called img_url please update the path  
  > **username_0**: Hi, i can see that the urls are not updated in the database but changing them to the current sub domain won't work either, have just tested by replacing the old sub domain with the new sub domain and got this error message:the image "http://www.example.com/example1/civicrm/contact/imagefile?photo=firstname_lastname_6580lk2b77fb4029f5a00000035d9" cannot be displayed because it contains errors  
  > **username_0**: Is this a bug? contact's images saved as absolute url makes it difficult to move the site  
  
  ---
  
  