Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
skru09's picture
Asked by on Thu 15th Apr 2010
Fatal error when calling a custom function in the node


I have written a custom php function and called the function in the node. I get the error “PHP Fatal error: Call to undefined function resize() in /var/www/html/includes/common.inc(1355) : eval()‘d code on line 149, “

Please find below how i have included the function and called in the node/page:

//php code
//call to function

$rep = resize($a,$b);

//more php code

//function definition
function resize($t_w,$t_h) {
$mwidth = 99;
$mht = 100;
$t_w>$mwidth) OR ($t_h>$mht)) {
$r1 = $mwidth/$t_w;
$r2 = $mht/$t_h;
$r1<$r2) {
$size = $mwidth/$t_w;
$size = $mht/$t_h;
$modwidth = $t_w * $size;
$modheight = $t_h * $size;

$a<a href="#fn93478293058730bbbf2d0a">0</a> = $modwidth;
$a<a href="#fn69659273058730bbbf2d54">1</a> = $modheight;

Can you please tell me what i am doing wrong??


Commenting on this Drupal Question is closed.