Total members 11894 |It is currently Thu Nov 21, 2024 5:50 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:
<?php
header
("Content-type: image/gif");
$height = 100;
$width = 200;
$fontsize = 50;
if ( ! isset (
$text ) )
    
$text = "www.codemiles.com";
$image = imagecreate( $width, $height );
$red = imagecolorallocate($image, 255,0,0);
$blue = imagecolorallocate($image, 0,0,255 );
$font = "ARIALBD.TTF";
$textwidth = $width;
$textheight;

while (
1 ){
    
$box = imageTTFbbox( $fontsize, 0, $font, $text );
    
$textwidth =  abs( $box[2] );
    
$textbodyheight = ( abs($box[7]) )-2;
    if (
$textwidth < $width - 20 )
        break;
    
$fontsize--;
}
$gifXcenter = (int) ( $width/2 );
$gifYcenter = (int) ( $height/2 );
imageTTFtext($image, $fontsize, 0,(int) ($gifXcenter-($textwidth/2)),(int)($gifYcenter+(($textbodyheight)/2) ),
             
$blue, $font, $text );
imagegif($image);
?>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Fixed Space Using imageTTFbbox()
 static vs fixed div position     -  
 simple example for fixed image     -  
 (3.0.4) Skymiles Setting Fixed WIDTH     -  
 hi i need ppt for space mouse.     -  
 Fixed Quantity Inventory model Simulator (C++)     -  
 White space link example     -  
 Get Disk total space     -  
 preserve the white space with-in the body tag     -  
 Get disk free space for Unix-Linux in php     -  
 remove space ,trim strings from left side ,right side ,both.     -  



Topic Tags

PHP Graphics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com