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 Drupal Modules (Moderator: Donald Lobo) »
  • Custom data image, Drupal Views, Thumbnails?
Pages: 1 [2] 3 4 ... 7

Author Topic: Custom data image, Drupal Views, Thumbnails?  (Read 31188 times)

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 03:52:19 pm
If you print_r($fields['image_1']->content); what do you get?

OK, I think I may have located the problem.  The first snippet has a file upload path partially hardcoded.  "/civicrm/custom/" is where this site was uploading files (under drupal's "sites/default/files" dir).  You might need to update the path in that code based on your upload path ("Custom Files" directory under Civicrm -> Settings ->Upload Directories).
« Last Edit: March 09, 2010, 04:03:19 pm by lentilsoup »

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 04:06:14 pm
I imagine that snippet goes into views-view-field--civicrm-events--block-3.tpl.php. Nothing happened.

... so, does that mean its not recognizing the views theme file?

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 04:12:02 pm
Yes, in that theme file.  Might be a problem with the theme file recognition, but you said that it's displaying other things that are only in that theme file?  Like I said, to double-check that it's recognizing and refreshing the theme file, just type in an "asdf" or something (outside the PHP braces) and see if it shows.  (Put it in an HTML comment and check the source, if you're working on a production site.)

Alternately, it could be that there's been a change to how the field is passed from the view to the template.  Try print_r($fields['image_1']); and let me know what that outputs.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 04:16:58 pm
Quote from: lentilsoup on March 09, 2010, 04:12:02 pm
but you said that it's displaying other things that are only in that theme file?
No, I misunderstood your instruction regarding the typed "nonsense". My change was to the block, not the theme view file. I'll execute your test properly this time with the appropriate gibberish.

Also, gotta scoot for a while. Wife is demanding my presence at a social engagement. BBL.

In the meantime, thank you very much for your (continuing) help. I have been totally lost with this.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 07:49:19 pm
Ah. The view theme file isn't being recognized. The "nonsense" outside the php braces isn't printing to the block, nor is the html comment. Substituting print_r($fields['image_1']); didn't change the situation.
« Last Edit: March 09, 2010, 08:02:22 pm by fm »

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 07:51:41 pm
Quote from: fm on March 09, 2010, 07:49:19 pm
Ah. The view theme file isn't being recognized. The "nonsense" outside the php braces isn't printing to the block, nor is the html comment.

That's clearly where the problem is.  I expect that if you can get that view template file recognized, you'll be all set.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 08:02:42 pm
Okay, I've gotten Drupal to recognize the view theme file. The "nonsense" and the html comment are printing; however, the image is still not displaying and the page is now throwing the following errors:

warning: array_shift() [function.array-shift]: The argument should be an array in ~/sites/all/themes/blueprint/blueprint/template.php on line 534.
warning: Division by zero in ~/includes/image.inc on line 160.


Line 534 of template.php is:

Code: [Select]
$file = array_shift(crm_get_file(array('id'=>$id)));
Line 160 of image.inc is:

Code: [Select]
$scale = max($width / $info['width'], $height / $info['height']);

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 08:18:16 pm
OK, comment out line 534 and temporarily replace it with:

Code: [Select]
$file = crm_get_file(array('id'=>$id)); die(print_r($file, TRUE));
And let me know what it outputs.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 08:40:31 pm
Output:
Code: [Select]
CRM_Core_Error Object ( [_errors] => Array ( [0] => Array ( [code] => 8000 [params] => Array ( [0] => ) [package] => CiviCRM [level] => Fatal [time] => 1268195267.26 [context] => Array ( [file] => ~/sites/all/modules/civicrm/CRM/Core/Error.php [line] => 417 [function] => createError [class] => CRM_Core_Error ) [message] => Required parameters missing. ) ) [_errorsByLevel] => Array ( [Fatal] => Array ( [0] => Array ( [code] => 8000 [params] => Array ( [0] => ) [package] => CiviCRM [level] => Fatal [time] => 1268195267.26 [context] => Array ( [file] => ~/sites/all/modules/civicrm/CRM/Core/Error.php [line] => 417 [function] => createError [class] => CRM_Core_Error ) [message] => Required parameters missing. ) ) ) [_package] => CiviCRM [_compat] => [_msgCallback] => Array ( [0] => CRM_Core_Error Object *RECURSION* [1] => getErrorMessage ) [_contextCallback] => Array ( [0] => CRM_Core_Error Object *RECURSION* [1] => getFileLine ) [_errorCallback] => Array ( ) [_logger] => Log_display Object ( [_lineFormat] => %3$s: %4$s
[_timeFormat] => %b %d %H:%M:%S [_opened] => [_id] => ec6c63f82ab30086dd3170170faca696 [_ident] => [_priority] => 6 [_mask] => 255 [_listeners] => Array ( ) [_formatMap] => Array ( [%{timestamp}] => %1$s [%{ident}] => %2$s [%{priority}] => %3$s [%{message}] => %4$s [%{file}] => %5$s [%{line}] => %6$s [%{function}] => %7$s [%{class}] => %8$s [%\{] => %%{ ) ) [_errorMsgs] => Array ( ) )

Sorry about the scrolly thing. The 'code' tags inside this output are making the text difficult to format. Ignore the 'code' close-tags at the end; forum.civicrm.org is automatically adding them.[/code][/code]

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 08:51:53 pm
It's saying there's a missing parameter, which either means that the API has changed since 3.1 or that the $id parameter isn't being passed properly.  Can you please remove the debugging line and replace it with:

Code: [Select]
die('pre ' . $id . ' post');

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 09:03:51 pm
Done. Now the page just displays "pre post".

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 09:06:39 pm
The ID isn't being passed properly to the function.  Restore that function to its original state, and let's go back to the view template.  Can you please add this code?

Code: [Select]
<pre><?php print_r($fields['image_1']); ?></pre>

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 09:19:20 pm
Done. The original page is restored, but the views block that is supposed to have the image is empty.

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 09:24:31 pm
It sounds to me like your image field is not in fact called image_1.

Try this in the view template:

Code: [Select]
<pre><?php print_r(array_keys($fields)); ?></pre>

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 09, 2010, 09:30:57 pm
Done. The block remains blank, but the page throws this error twice:

warning: array_keys() [function.array-keys]: The first argument should be an array in ~/sites/all/themes/blueprint/blueprint/views-view-field--civicrm-events--block-3.tpl.php on line 1.

Also, in Administer>Site Building>Views>Theme:Information>'Field CiviCRM Custom: Event Image: Image (ID: image_1)', the field ID seems to be identified as "image_1".
« Last Edit: March 09, 2010, 09:45:07 pm by fm »

Pages: 1 [2] 3 4 ... 7
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Custom data image, Drupal Views, Thumbnails?

This forum was archived on 2017-11-26.