imagecache preset function


/ Published in: PHP
Save to your folder(s)

imagecache preset depending on height and width of the image


Copy this code and paste it in your HTML
  1. <article class="clearfix">
  2.  
  3. <a href="<?php print $fields['path']->content; ?>">
  4.  
  5. <?php $result = image_get_info( $fields['field_afbeelding_fid']->content ); ?>
  6.  
  7. <?php if($result['width'] >= $result['height']) : ?>
  8. <img src="<?php print imagecache_create_url( 'product-liggend', $fields['field_afbeelding_fid']->content); ?>" alt="productgroep" />
  9. <?php else: ?>
  10. <img src="<?php print imagecache_create_url( 'product-staand', $fields['field_afbeelding_fid']->content); ?>" alt="productgroep" />
  11. <?php endif; ?>
  12.  
  13. <h3><?php print $fields['title']->content; ?></h3>
  14.  
  15. <div class="description" style="display: none;"><?php print $fields['field_samenvatting_value']->content; ?></div>
  16.  
  17. </a>
  18.  
  19. </article>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.