| 1 |
<?php |
<?php |
| 2 |
// $Id: image_filter.module,v 1.25 2007/10/15 04:41:29 davidhull Exp $ |
// $Id: image_filter.module,v 1.26 2007/10/20 20:17:15 davidhull Exp $ |
| 3 |
|
|
| 4 |
function image_filter_short_tip_translated() { |
function image_filter_short_tip_translated() { |
| 5 |
return t( |
return t( |
| 6 |
'You may link to images on this site <a href="!explanation-url">using a special syntax</a>', |
'You may link to images on this site <a href="!explanation-url">using a special syntax</a>', |
| 7 |
array('!explanation-url' => url('filter/tips', NULL, 'filter-image_filter-0'))); |
//array('!explanation-url' => url('filter/tips', NULL, 'filter-image_filter-0'))); |
| 8 |
|
array('!explanation-url' => url('filter/tips'))); |
| 9 |
} |
} |
| 10 |
|
|
| 11 |
function image_filter_long_tip_translated() { |
function image_filter_long_tip_translated() { |
| 129 |
|
|
| 130 |
$img = NULL; |
$img = NULL; |
| 131 |
|
|
| 132 |
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, f.filename, f.filepath FROM {files} f, {node} n WHERE n.status = 1 AND f.filemime LIKE 'image/%%' AND f.nid = n.nid AND n.nid = %d" . (strlen($size) != 0 ? " AND f.filename IN ('" . db_escape_string($size) . "','_original')" : '')), $match[1]); |
// $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, f.filename, f.filepath FROM {files} f, {node} n WHERE n.status = 1 AND f.filemime LIKE 'image/%%' AND f.nid = n.nid AND n.nid = %d" . (strlen($size) != 0 ? " AND f.filename IN ('" . db_escape_string($size) . "','_original')" : '')), $match[1]); |
| 133 |
|
$node = node_load($match[1], NULL, TRUE); |
| 134 |
// Loop over the files found for this image and select the best match. |
// Loop over the files found for this image and select the best match. |
| 135 |
while ($i = db_fetch_object($result)) { |
//while ($i = db_fetch_object($result)) { |
| 136 |
|
foreach( $node->images as $key => $img_path ) { |
| 137 |
|
$i->filepath = $img_path; |
| 138 |
|
$i->filename = $key; |
| 139 |
|
$i->nid = $node->nid; |
| 140 |
|
$i->title = $node->title; |
| 141 |
$i->size = getimagesize(file_create_path($i->filepath)); |
$i->size = getimagesize(file_create_path($i->filepath)); |
| 142 |
if (! $img) { |
if (! $img) { |
| 143 |
$img = $i; |
$img = $i; |
| 204 |
} |
} |
| 205 |
|
|
| 206 |
/** |
/** |
| 207 |
|
* Drupal 6 theme hook to declared themeable links: |
| 208 |
|
*/ |
| 209 |
|
function image_filter_theme() { |
| 210 |
|
return array( |
| 211 |
|
'image_inline_img' => array( |
| 212 |
|
'arguments' => array('img'), |
| 213 |
|
), |
| 214 |
|
); |
| 215 |
|
} |
| 216 |
|
|
| 217 |
|
|
| 218 |
|
/** |
| 219 |
* Theme function to render image in a node. |
* Theme function to render image in a node. |
| 220 |
* Displays a thumbnail with a link to the image. |
* Displays a thumbnail with a link to the image. |
| 221 |
*/ |
*/ |
| 234 |
($img->class ? " class=\"$img->class\"" : '') . |
($img->class ? " class=\"$img->class\"" : '') . |
| 235 |
($img->style ? " style=\"$img->style\"" : '') . " />"; |
($img->style ? " style=\"$img->style\"" : '') . " />"; |
| 236 |
if ($img->link) { |
if ($img->link) { |
| 237 |
$imgtag = l($imgtag, $img->link, array(), NULL, NULL, TRUE, TRUE); |
$imgtag = l($imgtag, $img->link, array( 'html' => TRUE )); |
| 238 |
} |
} |
| 239 |
if (isset($img->caption)) { |
if (isset($img->caption)) { |
| 240 |
$imgtag = "<div class=\"image_filter\">$imgtag<br />" . |
$imgtag = "<div class=\"image_filter\">$imgtag<br />" . |