| 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(). |
| 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)) { |
| 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 |