/[drupal]/contributions/modules/image_exact/image_exact.module
ViewVC logotype

Diff of /contributions/modules/image_exact/image_exact.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5.2.1, Fri Mar 7 20:18:59 2008 UTC revision 1.5.2.2, Fri Mar 7 20:58:47 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: image_exact.module,v 1.5 2008/03/07 19:59:05 joshk Exp $  // $Id: image_exact.module,v 1.5.2.1 2008/03/07 20:18:59 joshk Exp $
3    
4  /**  /**
5   * Implementation of hook_help().   * Implementation of hook_help().
# Line 82  function image_exact_admin_settings() { Line 82  function image_exact_admin_settings() {
82  *  *
83  * Looks for images and if the setting is set will resize thumbs  * Looks for images and if the setting is set will resize thumbs
84  */  */
85    /*
86  function image_exact_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {  function image_exact_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
87    //Set thumbnail final dimensions here - use settings from image content type.    //Set thumbnail final dimensions here - use settings from image content type.
88    if ($node->type == 'image' && in_array($op, array('submit', 'update')) && variable_get('image_exact_thumbs', 1)) {    if ($node->type == 'image' && in_array($op, array('submit', 'update')) && variable_get('image_exact_thumbs', 1)) {
# Line 98  function image_exact_nodeapi(&$node, $op Line 98  function image_exact_nodeapi(&$node, $op
98      }      }
99    }    }
100  }  }
101    */
102    
103    function image_exact_image_alter($node, $destination, $sizelabel) {
104      if (variable_get('image_exact_thumbs', 1)) {
105        // Find parameters and decide if resize or not
106        $sizes = _image_get_sizes();
107        foreach(variable_get('image_exact_size', array(0)) as $i) {
108          if ($sizelabel == $sizes[$i]['label']) {
109            $final_w = $sizes[$i]['width'];
110            $final_h = $sizes[$i]['height'];
111            $source = file_create_path($node->images[IMAGE_ORIGINAL]);
112          }
113        }
114        if ($final_w && $final_h) {
115          image_exact_resize($source, $destination, $final_w, $final_h);
116        }
117      }
118    }
119    
120  /*  /*
121  * Implementation of hook_user  * Implementation of hook_user

Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.5.2.2

  ViewVC Help
Powered by ViewVC 1.1.2