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] 5 6 7

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

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:08:24 pm
It ouputs the number 22.

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:12:43 pm
Where were you putting the previous print_r statements that were giving us all those arrays?

Anyway... back to where we started:

Code: [Select]
<?php
// $Id: views-view-fields.tpl.php,v 1.6 2008/09/24 22:48:21 merlinofchaos Exp $
/**
 * @file views-view-fields.tpl.php
 * Default simple view template to all the fields as a row.
 *
 * - $view: The view in use.
 * - $fields: an array of $field objects. Each one contains:
 *   - $field->content: The output of the field.
 *   - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
 *   - $field->class: The safe class id to use.
 *   - $field->handler: The Views field handler object controlling this field. Do not use
 *     var_export to dump this object, as it can't handle the recursion.
 *   - $field->inline: Whether or not the field should be inline.
 *   - $field->inline_html: either div or span based on the above flag.
 *   - $field->separator: an optional separator that may appear before a field.
 * - $row: The raw result object from the query, with all data it fetched.
 *
 * @ingroup views_templates
 */
?>

<?php $image_uri = url(get_civicrm_image($fields['image_1']->content)); echo $image_uri; ?>
<img src="<?php echo $image_uri; ?>" />

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:22:49 pm
At the end, but before ...

Code: [Select]
<?php endforeach; ?>
I just tried it after 'endforeach' and it seems to generate the same output:

Array ( [2] => Array ( [id] => 2 [file_type_id] => [mime_type] => image/jpeg [uri] => 72_dpi_Bosc_on_Box_edited_1_f3cf598b364fe47ea155995eddd67e49.jpg [document] => [description] => [upload_date] => 2010-03-11 10:01:35 ) )
« Last Edit: March 11, 2010, 08:25:55 pm by fm »

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:25:31 pm
And what do you get from that last snip I posted?

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:28:03 pm
The last snippet (from Reply #46) generates:

Array ( [2] => Array ( [id] => 2 [file_type_id] => [mime_type] => image/jpeg [uri] => 72_dpi_Bosc_on_Box_edited_1_f3cf598b364fe47ea155995eddd67e49.jpg [document] => [description] => [upload_date] => 2010-03-11 10:01:35 ) )
« Last Edit: March 11, 2010, 08:29:42 pm by fm »

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:30:48 pm
The snippet from 8:12?

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:31:40 pm
yes

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:34:00 pm
Removing everything else from the file?

I feel like we're looking at entirely different code, because there's no way that snippet outputs an array.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:37:45 pm
Yes, I thought that was odd; I wasn't expecting the array either. I replaced all the code in the file with your new code; saved the file to the site; then refreshed the page. I just checked it in another browser, and it's the same output.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:38:27 pm
I'm going to close all my apps and reboot.

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:40:53 pm
I'd worry more about making sure your template cache is cleared.  Do you still have that snippet at the top of template.php?

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:44:20 pm
yes, it's still there. I haven't touched the template.php file today at all.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:46:24 pm
I just changed the snippet to 'nonsense' and the nonsense output into the block on the front page where its supposed to print; in other words, the nonsense test worked.

fm

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 1
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:47:34 pm
I changed it back to your snippet and I'm getting the array again.

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Custom data image, Drupal Views, Thumbnails?
March 11, 2010, 08:48:08 pm
Quote from: fm on March 11, 2010, 08:44:20 pm
yes, it's still there. I haven't touched the template.php file today at all.

This snippet is still at the top of template.php?  
Code: [Select]
drupal_rebuild_theme_registry(); // clear theme cache on each page load
Please post the full contents of the view files that's outputting the array.

Pages: 1 2 3 [4] 5 6 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.