|
|
|
File: C:/usr/local/lib/php/blueshoes-4.2/core/gfx/text/Bs_TextType.class.php
BlueShoes Application Framework - gfx/text
Bs_TextType
Bs_Object | +-- Bs_TextType
TextType class.
|
public class Bs_TextType extends Bs_Object
TextType class.
creates images with text on it (for titles, navigation etc) that look better than just plain text.no need to have a designer create [all] the new title images just because the boss wantsanother text or another color.features:- use any fonts you want- use antialiasing- use transparency- use background colors or background images- create multiline textexample 1:$tt =& new Bs_TextType();$tt->imgWidth = 160;$tt->imgHeight = 20;$tt->posX = 5;$tt->posY = 14;$tt->fontSize = 14;$tt->fontFace = 'courbd';$tt->setText($text);$tt->create();$tt->send();$tt->destruct();example 1:$tt =& new Bs_TextType();$tt->imgWidth = 480;$tt->imgHeight = 53;$tt->posX = 1;$tt->posY = 36;$tt->fontSize = 48;$tt->fontFace = 'BKANT'; //courbd$tt->fontColor = array(24, 40, 66); //array(123, 121, 132);$tt->setFromRequest();$tt->create();$tt->save();$tt->send();$tt->destruct();special cases:multiline text:if you want a multiline image, use someting like:http://www.blueshoes.org/textType/h1/getit[Dx[Axhere[Dx[Axlala[Dx[Axfoobar.png[ will be converted to %and then %Dx and %Ax (Hex) will be converted to \r\n. go figure.the $imgHeight will be multiplied by the number of lines.so if you want to use [ in your text, you have to hack the code a bit.[ is good cause it also works in file names (caching images).the x after [A and [D is needed cause the convert function expects another char.just as in %20 for a space.dependencies: Bs_Url
| Authors | |
| Since | bs4.1 |
| Version | 4.0.$id$ |
| Copyright | blueshoes.org |
|
| |
|
Methods inherited from Bs_Object |
| isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean |
|
|
|
|
|
Public Field Summary |
| string |
$bgImageif you want to use a background image for your new text image, name it here. |
| string |
$imgTypeone of 'gif', 'jpg', 'png'. default is png. |
|
|
|
|
|
Public Method Details |
Bs_TextType |
|
public void Bs_TextType( )
|
| |
constructor
|
| Returns |
void |
|
destruct |
|
public void destruct( )
|
| |
destructor. please call it.
|
| Returns |
void |
|
setFromRequest |
|
public void setFromRequest( )
|
| |
sets the text and image type from the request. used with
.htaccess and redirect (see the blueshoes site example).call this method after setting the properties like imgHeight.
|
| Returns |
void |
|
setText |
|
public void setText( mixed $text )
|
| |
sets the text. may be an array for multiline.
|
| Parameter |
|
| mixed |
$text |
|
|
(string or vector) |
|
| Returns |
void |
| See Also |
$_text |
|
create |
|
public int create( )
|
| |
create the image based on the instance vars.
the return value was previously a bool, but now it's an int like this:1 => everything ok0 => some image has been crated, but with fallback stuff. (no truetype or so)-1 => failedhint: if you don't get a 1 back, you may not want to cache the image.
|
| Returns |
int (see above) |
| See Also |
get(), save(), send() |
|
get |
|
public void get( )
|
| |
returns the image.
call create() before calling this one.
|
| Returns |
void |
| See Also |
create(), save(), send() |
|
send |
|
public void send( )
|
| |
sends the created image to the browser directly.
does not stop code from executing. you may finish some other stuff,but you may not output other things to the browser.don't output anything at all (even before) to the browser whencalling this one. just one image is all the browser expects.
|
| Returns |
void |
| See Also |
create(), get(), save() |
|
save |
|
public bool save( [ string $fullPath ] )
|
| |
saves the image to the given path.
if the path is not given then $_SERVER['REDIRECT_URL'] willbe used (the file requested by the user). that's what you wantif you don't want something customized.call create() before calling this one.
|
| Parameter |
|
| string |
$fullPath |
= >>NULL<< |
|
|
|
| Returns |
bool |
| See Also |
create(), get(), send() |
|
|
|
|
Public Field Details |
$bgImage |
|
public string $bgImage
>><<
if you want to use a background image for your new text image, name it here.
if you do so, $imgWidth and $imgHeight will be ignored. your new image willhave the size of the bg image.place that image into the dir in your textType tree and give just thefile name. no path needed.
|
|
$imgType |
|
public string $imgType
>><<
one of 'gif', 'jpg', 'png'. default is png.
use lowercase!
|
|
|
Private Field Details |
$_text |
|
private array $_text
>><<
vector holding strings, each element represents a line.
|
| See Also |
setText() |
|
$_img |
|
private unknown $_img
>><<
the image object.
|
|
$Bs_Url |
|
private unknown $Bs_Url
>><<
|
|
$fontDir |
|
private string $fontDir
>>'../_fonts/'<<
|
|
$fontFace |
|
private unknown $fontFace
>><<
|
|
$fontAntiAlias |
|
private unknown $fontAntiAlias
>><<
|
|
$fontSize |
|
private unknown $fontSize
>><<
|
|
$fontColor |
|
private unknown $fontColor
>><<
|
|
$bgColor |
|
private unknown $bgColor
>><<
|
|
$imgWidth |
|
private unknown $imgWidth
>><<
|
|
$imgHeight |
|
private unknown $imgHeight
>><<
|
|
$posX |
|
private unknown $posX
>><<
|
|
$posY |
|
private unknown $posY
>><<
|
|
|
Private Constant Details |
BS_TEXTTYPE_VERSION
define( BS_TEXTTYPE_VERSION, >>4.0.$x$<< )
Case: default: case sensitive
|
|
|
|
|
|
| PHPDoc 1.0beta |