| 1 |
<?php |
<?php |
| 2 |
// $Id: textrender.inc,v 1.1.2.3 2009/08/31 04:12:20 dman Exp $ |
// $Id: textrender.inc,v 1.1.2.4 2009/09/15 23:42:00 dman Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file Helper functions for imagecache_textactions |
* @file Helper functions for imagecache_textactions |
| 5 |
* |
* |
| 17 |
* be ported over to there if that makes sense. |
* be ported over to there if that makes sense. |
| 18 |
*/ |
*/ |
| 19 |
|
|
|
require_once(dirname(__FILE__) . '/textactions.inc'); |
|
|
|
|
| 20 |
/** |
/** |
| 21 |
* Place text on top of the current canvas |
* Place text on top of the current canvas |
| 22 |
* |
* |
| 64 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 65 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 66 |
'#title' => t('PHP code help'), |
'#title' => t('PHP code help'), |
| 67 |
'#value' => file_get_contents(drupal_get_path('module', 'imagecache_textactions') .'/help/textrender_syntax.html'), |
'#value' => file_get_contents(drupal_get_path('module', 'imagecache_text') .'/help/textrender_syntax.html'), |
| 68 |
), |
), |
| 69 |
); |
); |
| 70 |
if (! user_access('administer site configuration')) { |
if (! user_access('administer site configuration')) { |
| 86 |
function theme_textactions_rendertext($element) { |
function theme_textactions_rendertext($element) { |
| 87 |
$data = $element['#value']; |
$data = $element['#value']; |
| 88 |
$style_atts = imageapi_text_parse_style($data['textstyle']['style']); |
$style_atts = imageapi_text_parse_style($data['textstyle']['style']); |
| 89 |
return t("<em><strong>@data</strong></em><br/>%style", array('@data' => $data['text'], '%style' => $data['textstyle']['style'])) ; |
return t("<em>\"<strong>@data</strong>\"</em><br/>%style<br/>%font", array( |
| 90 |
|
'@data' => $data['text'], |
| 91 |
|
'%style' => $data['textstyle']['style'], |
| 92 |
|
'%font' => basename($data['textstyle']['fontfile']) |
| 93 |
|
)) ; |
| 94 |
} |
} |
| 95 |
|
|
| 96 |
/** |
/** |
| 136 |
// $textimage should now have its size info available. |
// $textimage should now have its size info available. |
| 137 |
// Calc the position on the canvas |
// Calc the position on the canvas |
| 138 |
$xy = imagecache_actions_calculate_relative_position($image, $textimage, $style); |
$xy = imagecache_actions_calculate_relative_position($image, $textimage, $style); |
| 139 |
|
#dpm(get_defined_vars()); |
| 140 |
return imageapi_image_overlay($image, $textimage, $xy['x'], $xy['y']); |
return imageapi_image_overlay($image, $textimage, $xy['x'], $xy['y']); |
| 141 |
} |
} |
| 142 |
|
|