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 CiviContribute (Moderator: Donald Lobo) »
  • Personal Campaign Pages images not showing up
Pages: [1] 2

Author Topic: Personal Campaign Pages images not showing up  (Read 2803 times)

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
Personal Campaign Pages images not showing up
August 20, 2012, 03:03:40 pm
I am unable to get images in personal campaign pages on Wordpress to show up.  I was able to reproduce the error on the wordpress demo site:

http://wordpress.demo.civicrm.org/?page=CiviCRM&q=civicrm/pcp/info&reset=1&id=1

The same thing occurs on my site, I get the tiny broken image icon instead.

This is what the image source reads:
Code: [Select]
<img src="/?page=CiviCRM&amp;q=civicrm/file&amp;page_id=2&amp;reset=1&amp;id=1&amp;eid=1">
When I inspect the element and try and download the image, it downloads what appears to be the correct file (called 'test') but I cannot get it to open back up on my computer.

Any idea why it is not displaying the image?


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: Personal Campaign Pages images not showing up
August 20, 2012, 06:16:17 pm

we have an issue with WP currenly where WP is spitting out some html before handing over control to civicrm.

seems like this bug is due to that issue.

If you are a WP developer (or know of one!), would be great if you can help debug and fix this issue

I suspect this impacts a few other places where we want to just output the right stuff and skip wp's html

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

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
Re: Personal Campaign Pages images not showing up
August 21, 2012, 07:01:26 am
Thank you for your reply, it helps to know it not something I'm doing wrong! I am not a WordPress developer but perhaps know one that might help us out. If I figure anything out I will, of course, pass it along!

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 03, 2013, 09:16:11 am
I'm not a WordPress developer but I'll try posting on a WordPress forum to see if I can find an answer.  However, I want to clarify my understanding of the issue.  I looked at the CiviCRM code to the best of my ability.  Here's my understanding of the issue.

The browser tries to retrieve the photo from a URL like this: http://phoenixacademyomaha.org/?page=CiviCRM&q=civicrm/file&page_id=11&reset=1&id=1&eid=1.  However, a HTLM header for the website is appended to the photo binary.  The photo is downloaded to the browser using the "download" function in CRM\Utils\System.php.  The line of code doing this is on line 710 and is:

Code: [Select]
print $buffer;
Is this correct?

Interestingly, if you are logged on to CiviCRM the photo is correctly downloaded using this related URL: http://phoenixacademyomaha.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/file&reset=1&id=1&eid=1

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 04, 2013, 10:47:48 am
I just posted this on the wordpress.org forums to see if anyone there can help.

http://wordpress.org/support/topic/civicrm-plugin-image-display-problem?replies=1#post-4161514

They could be alternative mention to display images on PCPs.  A PCP could use a direct link to the image of the from "website/wp-content/plugins/files/civicrm/custom/image.jpg".  I plugged such a URL into my PCP using FireBug and the image was displayed.

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 04, 2013, 01:27:25 pm
I just posted on stackover.com seeking help.  The post is here:

http://stackoverflow.com/questions/16378632/display-image-on-wordpress-webpage-using-php-code-civicrm-plugin

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: Personal Campaign Pages images not showing up
May 04, 2013, 04:47:11 pm
can u try this patch on 4.3.x and see if it works:

Code: [Select]
diff --git a/civicrm.php b/civicrm.php
index 0f5d8cf..35b03c8 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -399,6 +399,11 @@ function civicrm_wp_frontend($shortcode = FALSE) {
       CRM_Utils_Array::value(2, $args) == 'ical' &&
       // skip the html page since that is rendered in the CMS theme
       CRM_Utils_Array::value('html', $_GET) != 1
+    ) ||
+    // skip the html when outputting a file
+    (
+      CRM_Utils_Array::value(0, $args) == 'civicrm' &&
+      CRM_Utils_Array::value(1, $args) == 'file'
     )
   ) {
     add_filter('init', 'civicrm_wp_invoke');

I gave this a shot and it seemed to work. Note that for anon users you do need to give the permission "access uploaded files" if you want this ability (i add to activate and deactivate civicrm to get anonymous user in my permissions grid)

lobo
« Last Edit: May 04, 2013, 07:15:18 pm by Donald 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

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 05, 2013, 12:59:06 pm
This is great!  It works like a champ.  My hat is off to you Lobo.

You can see my live PCP here: http://phoenixacademyomaha.org/crm/?page=CiviCRM&q=civicrm/pcp/info&reset=1&id=1

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: Personal Campaign Pages images not showing up
May 05, 2013, 02:23:01 pm

1. Can you please file an issue so we can get this into 4.3

2. Please consider contributing to the project to help maintain and improve the project.

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

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 06, 2013, 06:23:39 am
I just made a personal donation to the Soft Credit Improvements make it happen project.  It pays to ask.

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: Personal Campaign Pages images not showing up
May 06, 2013, 07:19:54 am

thanx :)

now you need to convince 10 other people to contribute :P

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

aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
May 06, 2013, 07:22:03 am
You're a real taskmaster ::)

arthur

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: WordPress
  • MySQL version: 5.1.68
  • PHP version: 5.3.17
Re: Personal Campaign Pages images not showing up
June 25, 2013, 09:50:18 am
We have been experiencing the same problem with our Wordpress Install - can someone tell me where the patch posted above by Donald Lobo gets added to? i.e. what file it goes in?

I am new to civicrm, but am very impressed with all it can do. Thank for any info you can provide.


aglozier

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 9
    • Phoenix Academy
  • CiviCRM version: 4.7.9
  • CMS version: WordPress 4.6.1
  • MySQL version: 5.7.14
  • PHP version: 5.6.21
Re: Personal Campaign Pages images not showing up
June 25, 2013, 01:26:41 pm
This patch didn't make it into 4.3.4.  I applied the patch to 4.3.4 and it works.

Will this patch be in 4.3.5?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Personal Campaign Pages images not showing up
June 27, 2013, 04:23:41 pm
Thx - doesn't seem like it got committed, checking on status now.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Personal Campaign Pages images not showing up

This forum was archived on 2017-11-26.