Location: PHPKode > projects > Opensheet > opensheet/functions/draw.pics.inc.php
<?php

function draw_proj($text) {

$font = "fonts/arial.ttf";

$string = mb_substr($text,0,30, 'utf-8');
#$string2 = mb_substr($text,18,18,'utf-8');
#$br="\r\n";
$type="png";

$file_name =  implode("****", array($text, 'png'));;



#$text = $string . $br . $string2;
$text = $string;


$file_name = str_replace('"', "", $file_name);
$file_name = str_replace(",", "", $file_name);
$file_name = str_replace(".", "", $file_name);
$file_name = str_replace(" ", "", $file_name);
$file_name = str_replace("/", "", $file_name);
#$file_name = preg_replace( '/\p{Zs}/u', ' ', $file_name );

$file_name = str_replace('****', ".", $file_name);


if(file_exists("cache/$file_name")) {} else { 


  define('WIDTH', 220);
  define('HEIGHT', 25);
  define('FONT_NAME', $font);
  define('FONT_SIZE', 10);

  $image = imagecreatetruecolor(WIDTH,HEIGHT)   or die('Cannot create image');
  imagefill($image, 0, 0, hexdec("EAF5BF"));
 
  $coord = imagettfbbox(
     FONT_SIZE,  
     0,         
     FONT_NAME,  
     $text       
     );

  
  $width = $coord[2] - $coord[0];
  $height = $coord[1] - $coord[7];

 

  $X = (WIDTH - $width) / 2;
  $Y = (HEIGHT + $height) / 2;

  imagettftext(
    $image,     
    FONT_SIZE,  
    0,          
    5, 20,      
                
    0x000000,    
    FONT_NAME,   
    $text
  );


  imagepng($image,"cache/$file_name");
  imagedestroy($image);

#Rotate
$angle = 90;
$bgColour = 0xFFFFFF;

$original = imagecreatefrompng("cache/$file_name");
$rotated = imagerotate($original, $angle, $bgColour);
imagepng($rotated,"cache/$file_name");
}

return $file_name;
}



?>
Return current item: Opensheet