/ Published in: PHP
imagecache preset depending on height and width of the image
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<article class="clearfix"> <a href="<?php print $fields['path']->content; ?>"> <?php $result = image_get_info( $fields['field_afbeelding_fid']->content ); ?> <?php if($result['width'] >= $result['height']) : ?> <img src="<?php print imagecache_create_url( 'product-liggend', $fields['field_afbeelding_fid']->content); ?>" alt="productgroep" /> <?php else: ?> <img src="<?php print imagecache_create_url( 'product-staand', $fields['field_afbeelding_fid']->content); ?>" alt="productgroep" /> <?php endif; ?> <h3><?php print $fields['title']->content; ?></h3> <div class="description" style="display: none;"><?php print $fields['field_samenvatting_value']->content; ?></div> </a> </article>