Help me with mod scripting

Started by ***Teh GodFather***, March 26, 2008, 05:53:07 PM

Previous topic - Next topic

***Teh GodFather***

I am asking this for tenth time...  It is about BBC coding... But now I think I have solution which will work but I get error with php syntax...

I have this code

array(
'tag' => 'imgt',
'type' => 'unparsed_content',
'content' =>
// Load image
$image = open_image("$1");

// Get original width and height
$width = imagesx($image);
$height = imagesy($image);

// Calculate new width and height using percentage
$percent = 0.30;

$new_width = $width * $percent;
$new_height = $height * $percent;
'
<a href="$1" target="_blank"><img src="$1" width="$width" height="$height" border="0" /></a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),


You probably see where is error, but I don't know how to solve this...

I get this error:

QuoteParse error: syntax error, unexpected ';', expecting ')' in ...forumdir.../Sources/Subs.php on line 1602

Spaceman-Spiff

It seems that you have not finished your array declaration in line 4.

My guess is this chunk of code was pasted in the middle, which cause the problem:

    // Load image
    $image = open_image("$1");
   
    // Get original width and height
    $width = imagesx($image);
    $height = imagesy($image);
   
    // Calculate new width and height using percentage
    $percent = 0.30;
   
    $new_width = $width * $percent;
    $new_height = $height * $percent;


If you move it after or before the array declaration, it shouldn't cause a parse error.

***Teh GodFather***

I tried that, but this is in bbc array, i don't know will it work if i move it before that array... I'll try it when i get home...

Advertisement: