hi all, see what I found this:
http://zend.com/zend/tut/tutorial-mehmet1.php
but I don’t know how can it work on linux hosting ? because in image.php it required font path … on window lol
I try all: define $font …
and I found this code in IBF:
*-------------------------------------------------------------------------*/
//
// Show GD created security image...
//
/*-------------------------------------------------------------------------*/
function show_gd_img($content="")
{
global $ibforums, $DB;
flush();
@header("Content-Type: image/jpeg");
if ( $ibforums->vars['use_ttf'] != 1 )
{
$font_style = 5;
$no_chars = strlen($content);
$charheight = ImageFontHeight($font_style);
$charwidth = ImageFontWidth($font_style);
$strwidth = $charwidth * intval($no_chars);
$strheight = $charheight;
$imgwidth = $strwidth + 15;
$imgheight = $strheight + 15;
$img_c_x = $imgwidth / 2;
$img_c_y = $imgheight / 2;
$im = ImageCreate($imgwidth, $imgheight);
$text_col = ImageColorAllocate($im, 0, 0, 0);
$back_col = ImageColorAllocate($im, 200,200,200);
ImageFilledRectangle($im, 0, 0, $imgwidth, $imgheight, $text_col);
ImageFilledRectangle($im, 3, 3, $imgwidth - 4, $imgheight - 4, $back_col);
$draw_pos_x = $img_c_x - ($strwidth / 2) + 1;
$draw_pos_y = $img_c_y - ($strheight / 2) + 1;
ImageString($im, $font_style, $draw_pos_x, $draw_pos_y, $content, $text_col);
}
else
{
$image_x = isset($ibforums->vars['gd_width']) ? $ibforums->vars['gd_width'] : 250;
$image_y = isset($ibforums->vars['gd_height']) ? $ibforums->vars['gd_height'] : 70;
$im = imagecreate($image_x,$image_y);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$grey = ImageColorAllocate($im, 200, 200, 200 );
$no_x_lines = ($image_x - 1) / 5;
for ( $i = 0; $i <= $no_x_lines; $i++ )
{
// X lines
ImageLine( $im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey );
// Diag lines
ImageLine( $im, $i * $no_x_lines, 0, ($i * $no_x_lines)+$no_x_lines, $image_y, $grey );
}
$no_y_lines = ($image_y - 1) / 5;
for ( $i = 0; $i <= $no_y_lines; $i++ )
{
ImageLine( $im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey );
}
$font = isset($ibforums->vars['gd_font']) ? $ibforums->vars['gd_font'] : getcwd().'/fonts/progbot.ttf';
$text_bbox = ImageTTFBBox(20, 0, $font, $content);
$sx = ($image_x - ($text_bbox[2] - $text_bbox[0])) / 2;
$sy = ($image_y - ($text_bbox[1] - $text_bbox[7])) / 2;
$sy -= $text_bbox[7];
imageTTFtext($im, 20, 0, $sx, $sy, $black, $font, $content);
}
ImageJPEG($im);
ImageDestroy($im);
exit();
}
in this code I dont know what ** $font = isset($ibforums->vars[‘gd_font’]) ? $ibforums->vars[‘gd_font’] : getcwd().’/fonts/progbot.ttf’; [/] mean too!
please help me, guys!