473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

site help

ok something is missing or what not... its driving me nuts.
stupidralph, i recall that u are a coder. what is missing???

<?

class textPNG {
var $font = 'fonts/TIMES.TTF';
var $msg = "undefined";
var $size = 24;
var $rot = 0;
var $pad = 0;
var $transparent = 1;
var $red = 0;
var $grn = 0;
var $blu = 0;
var $bg_red = 255;
var $bg_grn = 255;
var $bg_blu = 255;

function draw() {
$width = 0;
$height = 0;
$offset_x = 0;
$offset_y = 0;
$bounds = array();
$image = "";

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, "W");
if ($this->rot < 0) {
$font_height = abs($bounds[7]-$bounds[1]);
} else if ($this->rot > 0) {
$font_height = abs($bounds[1]-$bounds[7]);
} else {
$font_height = abs($bounds[7]-$bounds[1]);
}

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font,
$this->msg);
if ($this->rot < 0) {
$width = abs($bounds[4]-$bounds[0]);
$height = abs($bounds[3]-$bounds[7]);
$offset_y = $font_height;
$offset_x = 0;

} else if ($this->rot > 0) {
$width = abs($bounds[2]-$bounds[6]);
$height = abs($bounds[1]-$bounds[5]);
$offset_y = abs($bounds[7]-$bounds[5])+$font_height;
$offset_x = abs($bounds[0]-$bounds[6]);

} else {
$width = abs($bounds[4]-$bounds[6]);
$height = abs($bounds[7]-$bounds[1]);
$offset_y = $font_height;;
$offset_x = 0;
}

$image = imagecreate($width+($this->pad*2)+1,$height+($this->pad*2)+1);

$background = ImageColorAllocate($image, $this->bg_red, $this->bg_grn,
$this->bg_blu);
$foreground = ImageColorAllocate($image, $this->red, $this->grn,
$this->blu);

if ($this->transparent) ImageColorTransparent($image, $background);
ImageInterlace($image, false);

ImageTTFText($image, $this->size, $this->rot, $offset_x+$this->pad,
$offset_y+$this->pad, $foreground, $this->font, $this->msg);

imagePNG($image);
}
}

$text = new textPNG;

if (isset($msg)) $text->msg = $msg;
if (isset($font)) $text->font = $font;
if (isset($size)) $text->size = $size;
if (isset($rot)) $text->rot = $rot;
if (isset($pad)) $text->pad = $pad;
if (isset($red)) $text->red = $red;
if (isset($grn)) $text->grn = $grn;
if (isset($blu)) $text->blu = $blu;
if (isset($bg_red)) $text->bg_red = $bg_red;
if (isset($bg_grn)) $text->bg_grn = $bg_grn;
if (isset($bg_blu)) $text->bg_blu = $bg_blu;
if (isset($tr)) $text->transparent = $tr;

$text->draw();
?>

Mar 10 '06 #1
1 1075
ta******@gmail.com wrote:
ok something is missing or what not... its driving me nuts.
stupidralph, i recall that u are a coder. what is missing???

<?

class textPNG {
var $font = 'fonts/TIMES.TTF';
var $msg = "undefined";
var $size = 24;
var $rot = 0;
var $pad = 0;
var $transparent = 1;
var $red = 0;
var $grn = 0;
var $blu = 0;
var $bg_red = 255;
var $bg_grn = 255;
var $bg_blu = 255;

function draw() {
$width = 0;
$height = 0;
$offset_x = 0;
$offset_y = 0;
$bounds = array();
$image = "";

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font, "W");
if ($this->rot < 0) {
$font_height = abs($bounds[7]-$bounds[1]);
} else if ($this->rot > 0) {
$font_height = abs($bounds[1]-$bounds[7]);
} else {
$font_height = abs($bounds[7]-$bounds[1]);
}

$bounds = ImageTTFBBox($this->size, $this->rot, $this->font,
$this->msg);
if ($this->rot < 0) {
$width = abs($bounds[4]-$bounds[0]);
$height = abs($bounds[3]-$bounds[7]);
$offset_y = $font_height;
$offset_x = 0;

} else if ($this->rot > 0) {
$width = abs($bounds[2]-$bounds[6]);
$height = abs($bounds[1]-$bounds[5]);
$offset_y = abs($bounds[7]-$bounds[5])+$font_height;
$offset_x = abs($bounds[0]-$bounds[6]);

} else {
$width = abs($bounds[4]-$bounds[6]);
$height = abs($bounds[7]-$bounds[1]);
$offset_y = $font_height;;
$offset_x = 0;
}

$image = imagecreate($width+($this->pad*2)+1,$height+($this->pad*2)+1);

$background = ImageColorAllocate($image, $this->bg_red, $this->bg_grn,
$this->bg_blu);
$foreground = ImageColorAllocate($image, $this->red, $this->grn,
$this->blu);

if ($this->transparent) ImageColorTransparent($image, $background);
ImageInterlace($image, false);

ImageTTFText($image, $this->size, $this->rot, $offset_x+$this->pad,
$offset_y+$this->pad, $foreground, $this->font, $this->msg);

imagePNG($image);
}
}

$text = new textPNG;

if (isset($msg)) $text->msg = $msg;
if (isset($font)) $text->font = $font;
if (isset($size)) $text->size = $size;
if (isset($rot)) $text->rot = $rot;
if (isset($pad)) $text->pad = $pad;
if (isset($red)) $text->red = $red;
if (isset($grn)) $text->grn = $grn;
if (isset($blu)) $text->blu = $blu;
if (isset($bg_red)) $text->bg_red = $bg_red;
if (isset($bg_grn)) $text->bg_grn = $bg_grn;
if (isset($bg_blu)) $text->bg_blu = $bg_blu;
if (isset($tr)) $text->transparent = $tr;

$text->draw();
?>


It would help if you told us what you're expecting, and what you're getting!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Mar 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim | last post by:
This si a repost, I apologize but perhaps my original inquiry got buried under all the usenet spam... I need some help getting started with a .NET web project for a commercial site. I am new to...
7
by: Venkat | last post by:
Hi All, I would like to about Cross Site Scripting. I googled XSS and got the point what it is but didn't get how it is achieved. Can someone describe me with an example how an hacker does it....
0
by: HackingPSP | last post by:
I saw a lot of requests for a program like this, so I wrote it. Yeah, my site has "PSP software by Auri" but in this case it means "Pretty Sweet Programming" :) There's both a VS2005 add-in and a...
3
by: vijaykokate | last post by:
Our company http://www.softnmation.com/ offers its customers a great variety of products. Everything you need can be found in this site. Web Template, CSS Template, Logo Template, Corporate...
9
by: CK | last post by:
Hi All, I have a sharepoint site on a box. I can hit the box by going to the ip address http://10.0.0.1/default.aspx but I can not hit it by name. The password dialong box comes up and it rejects...
2
by: Word Painter | last post by:
this may be more of an "html" issue, but I'll wing it. i've got a multi-language site, where the home-page of each language group features a link to a popup window that offers background info on...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
8
by: Paul W Smith | last post by:
I currently have a web site at www.middlesexccl.com I am also developing a new version of the web site using ASP.NET. I would like to give certain people access to this for evaluation purposes,...
18
by: sebastian | last post by:
Can this be done without client-side scripting? I thought sessions might be the answer but after some testing found that sometimes the old session data remained even after the user left the site...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.