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) »
  • Contact Image URL and Display Issues
Pages: [1]

Author Topic: Contact Image URL and Display Issues  (Read 1175 times)

utskidad

  • Guest
Contact Image URL and Display Issues
November 22, 2010, 12:07:50 pm
1. Using the built-in contact image functionality.

2.  JPEG uploads to contact record without problem, but image does not display in browser. 

3.  Browser VIEW SOURCE on page shows:

<div>
            <div class="crm-contact_image crm-contact_image-block">
        <a href="#" onClick="contactImagePopUp('sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg',400,600);">
            <img src="sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg" height = 100 width=66.6666666667>
        </a>
    </div>
       
    <script>
   function contactImagePopUp(url, width, height) {
            newwindow = window.open(url,'name', 'width='+width+', height='+height );
        }   
    </script>
        </div>

4.  When I click on the image placeholder, it opens  the following URL: 

http://<MYDOMAIN.COM>/civicrm/contact/sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg

The proper URL would be:  http://<MYDOMAIN.COM>/sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg. 

In other words, "civicirm/contact" is erroneously inserted after domain name and before proper file path.

5.  When I pull up the printer friendly version of the contact record, the thumbnail displays properly and clicking on the thumbnail produces the expected result of seeing the full-size image in a new browser window.

In the printer friendly page, VIEW SOURCE displays:

   <div>
            <div class="crm-contact_image crm-contact_image-block">
        <a href="#" onClick="contactImagePopUp('sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg',400,600);">
            <img src="sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg" height = 100 width=66.6666666667>
        </a>
    </div>
       
    <script>
   function contactImagePopUp(url, width, height) {
            newwindow = window.open(url,'name', 'width='+width+', height='+height );
        }   
    </script>
        </div>


And clicking on the image produces a new browser window with the following URL: 

http://<MYDOMAIN.COM>/sites/default/files/civicrm/custom/1057891516_yss59_L_1_9d908c14a74c410f12a1d53dfc05e16a.jpg

which is entirely correct.  This is in contrast to the result generated when clicking on the  regular contact view image, which introduces "civicrm/contact" into the URL.   

6.  I note that on the CIVCRM sandbox, a VIEW SOURCE of a contact record containing a contact image displays a IMG SRC field with a URL, not a relative path (e.g. http://sadbox.org/path/imag.jpg).  Whereas my system is displaying a relative file path. 

Any help would be greatly appreciated.  I've scrutinized and tweaked the resource URLs and directory paths to no avail.

CIVICRM 3.2.25 and Drupal 6.19. 



Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Contact Image URL and Display Issues
November 23, 2010, 07:25:48 pm
AFAIK the normal summary page and the print view are built using the same code / logic so the URLs should be the same. You might want to do a view source on the normal contact summary page and see if somehow a <base href= ... /> tag is setting civicrm/contact for images or ??

http://www.w3schools.com/tags/att_base_href.asp
Protect your investment in CiviCRM by  becoming a Member!

utskidad

  • Guest
Re: Contact Image URL and Display Issues
November 24, 2010, 08:20:32 am
Thanks for the idea, but no base URL html tagging found. 

You're right about the templates.  I ran a smartydebug dump on both versions -- summary and printer friendly -- and they look identical, including reference to the same template file. 

That got me thinking it might be something in the Drupal environment, as the only difference between the two versions seems to be the drupal header.  So, I changed my Drupal Acquia Marina theme to the default Drupal Garland theme, and a few other themes, but I got the same bad result. 




Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Contact Image URL and Display Issues
November 24, 2010, 10:26:46 am
Hmm - no idea then what's happening. You might have to debug this in the PHP code which generates the image URL. Check out what's happening CRM/Contact/BAO/Contact getRelativePath().
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Contact Image URL and Display Issues

This forum was archived on 2017-11-26.