User login

Theming views to use imagecache

Agaric needs to make a view, such as a preview of an image gallery for the front page of a site, use imagecache to generate cropped and resized thumbnails.

Resolution

<?php
 print_r($node);
?>

stdClass Object
(
[nid] => 6
[files_filepath] => sites/anjaliforberpratt.com/files/images/137901886019f.jpg
)

So it's saying, I am an object, I am called node, this is what I am made up of.

We want it to print our node, the entire node.

So we have to load it:

$agaric_image_node = node_load()

Here we've found the piece we care about:

[images] => Array (
[_original] => sites/anjaliforberpratt.com/files/images/137901886019f.jpg
[preview] => sites/anjaliforberpratt.com/files/images/137901886019f.preview.jpg
[thumbnail] => sites/anjaliforberpratt.com/files/images/137901886019f.thumbnail.jpg
)

This is in a node object, so when we call it it will be in the form $agaric_image_node->images['_original'].

And this is the most inefficient way to theme an image to use an imagecache preset through views that I can imagine.

If there isn't a view that can output the filepath of the original image, we should make a module that does that.

Searched words: 
views, imagecache, and theming view templates

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.