Drupal: Imagecache presets in templates


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



Copy this code and paste it in your HTML
  1. <pre>
  2. <?php if ($account->picture) {
  3. print theme('imagecache', 'profile_pic', $account->picture, $alt, $title, $attributes);
  4. }
  5. else {
  6. print theme('imagecache', 'profile_pic', default_profile_pic.png, $alt, $title, $attributes);
  7. }
  8. ?>
  9. </pre>
  10.  
  11. //or this
  12. function theme_profile($image_path) {
  13. if (!$image_path) {
  14. $image_path = [path_to_default_image]
  15. }
  16. return theme('imagecache', $preset_name, $image_path);
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.