Is there a module that will show thumbnail in teaser and full image in story?

Comments

catch’s picture

I'm currently doing this with a combination of:

CCK (to make node types like "news" or whatever)
imagefield (to add images to CCK node types)
content templates (contemplate) (to make customised layouts and teasers)
imagecache (to generate thumbnails on the fly - if you want a different size thumbnail later on, you just change a couple of settings and it updates every old thumbnail for you.

Took a while to get it all working together, and still playing around with it.

ezichko’s picture

i would love the know how to do this too

whereisian’s picture

imagefield, imagecache, and cck. I orginally had contemplate installed, which was invaluable for learning how to theme. While troubleshooting a clean urls/relative paths issue, I moved to tpl files. Right now I'm attempting to theme views for the first time.

First I configured imagefield and imagecache. This can be tricky as these modules are still pretty young. See link. I have primary and secondary imagefields, where primary is restricted to 1 image and secondary is multiple values, so as to gel with current views.module limitations. I have 3 profiles in imagecache that scale. Haven't tried crop or resize yet.

I then made a node-content_my_cck_type.tpl.php and put this in it. You might have guessed that I'm building an object catalog :) Hope this helps.

<?php if ($page == 0): //if node is being displayed as a teaser
?>

<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php print $picture ?>
<div class="info"><?php print $submitted .'<span class="taxonomy">'. ($submitted ? ' :: ' : '') . $terms .'</span>' ?></div>
<div class="content">

<div class="catalog-teaser">
<div class="primary-image">
<?php foreach ((array)$field_primary_image as $item) { 
if (empty($item['filepath'])) continue; ?>
<a href="<?php print $GLOBALS['base_url'] ?>/node/<?php print $nid ?>">
<img src="<?php print $GLOBALS['base_url'] ?>/files/imagecache/thumbnail/<?php print $item['filepath'] ?>" alt="<?php print $item['alt'] ?>" title="<?php print $item['title'] ?>" />
</a>
<?php } ?>
</div>

<div class="main-info">
<span class="field-label field-label field-label-creator"></span>
<span class="field-value field-value-creator"><?php print $field_creator[0]['view'] . ' - ' ?></span>
<span class="field-label field-label-year-created"></span>
<span class="field-value field-value-year-created"><?php print $field_year_created[0]['view'] . ' ' ?></span>
<br>
<span class="field-label field-label-local-id"></span>
<span class="field-value field-value-local-id"><?php print $field_local_id[0]['view'] . ' ' ?></span>
</div>
</div>
</div>

<?php if ($links): ?>
<?php if ($picture): ?>
<br class="clear" />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>


<?php endif;
if ($page == 1): //if node is being displayed as a full node
?>

<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php print $picture ?>
<div class="info"><?php print $submitted .'<span class="taxonomy">'. ($submitted ? ' :: ' : '') . $terms .'</span>' ?></div>
<div class="content">

<div class="catalog-full">
<div class="catalog-images">	
<?php foreach ((array)$field_primary_image as $item) { 
if (empty($item['filepath'])) continue; ?>
<div class="primary-image">
<img src="<?php print $GLOBALS['base_url'] ?>/files/imagecache/preview/<?php print $item['filepath'] ?>" alt="<?php print $item['alt'] ?>" title="<?php print $item['title'] ?>" /><br>
<span class="links">
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/thumbnail/<?php print $item['filepath'] ?>">Thumb</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/preview/<?php print $item['filepath'] ?>">Preview</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/presentation/<?php print $item['filepath'] ?>">Presentation</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/<?php print $item['filepath'] ?>">Original</a>
</span>
</div>
<?php } ?>

<?php foreach ((array)$field_secondary_images as $item) { 
if (empty($item['filepath'])) continue; ?>
<div class="secondary-images">
<img src="<?php print $GLOBALS['base_url'] ?>/files/imagecache/thumbnail/<?php print $item['filepath'] ?>" alt="<?php print $item['alt'] ?>" title="<?php print $item['title'] ?>" /><br>
<span class="links">
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/thumbnail/<?php print $item['filepath'] ?>">Thumb</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/preview/<?php print $item['filepath'] ?>">Preview</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/files/imagecache/presentation/<?php print $item['filepath'] ?>">Presentation</a> 
<a href="<?php print $GLOBALS['base_url'] ?>/<?php print $item['filepath'] ?>">Original</a>
</span>
</div>
<?php } ?>
</div>

<div class="main-info">
<h3>Main Information</h3>

<span class="field-label field-label-alternate-titles">Alternate Titles: </span>
<?php foreach ((array)$field_alternate_titles as $item) { ?>
<span class="field-value field-value-alternate-titles"><?php print $item['view'] . ' ' ?></span>
<?php } ?>
<br>

<span class="field-label field-label-category">Category: </span>
<?php foreach ((array)$field_category as $item) { ?>
<span class="field-value field-value-category"><?php print $item['view'] . ' ' ?></span>
<?php } ?>
<br>

<span class="field-label field-label-creator">Creator: </span>
<?php foreach ((array)$field_creator as $item) { ?>
<span class="field-value field-value-creator"><?php print $item['view'] . ' ' ?></span>
<?php } ?>
<br>

<span class="field-label field-label-year-created">Year Created: </span>
<?php foreach ((array)$field_year_created as $item) { ?>
<span class="field-value field-value-year-created"><?php print $item['view'] . ' ' ?></span>
<?php } ?>
<br>

<span class="field-label field-label-local-id">Local ID: </span>
<?php foreach ((array)$field_local_id as $item) { ?>
<span class="field-value field-value-local-id"><?php print $item['view'] . ' ' ?></span>
<?php } ?>
</div>
</div>
<?php if ($links): ?>
<?php if ($picture): ?>
<br class="clear" />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>

<?php
endif;
?>
pyc’s picture

It's pretty neat way and everything is ok except I really don't know how to insert thumbnail image into template... And as far as I see, there is not example in Variables section, only for full-sized picture... Please can you help a bit?

elv’s picture

I'm also trying but without CCK (with standard page nodes). Has anybody found a way to achieve this?