Hello,
I created a nice (and simple for now) GD class.
The problem is , it works great on wamp, but not in my hostgator acount ( Linux )i tried it on byethost
and it didnt worked as well.
I am posting the class :
Code: <?php
/*
* Created by Eliad Moshe.
* Oranit 5,
* Israel.
*
* email: eliad154@Gmail.com
*
*/
class GD
{ // start of class GD
public $image_pointer , $color_pointer ;
function __construct ( $image_width, $image_height )
{ // start of function __construct ()
$this->image_pointer = imagecreatetruecolor ($image_width, $image_height);
} // end of function __construct ()
function set_color ( $color )
{ // start of function set_color ()
$color = substr( $color, 1 , 6 ); // get rid of "#"
$color = str_split( $color , 2 ); // make 3 chanks of 2 chars.
/* Red Green Blue */
$this->color_pointer = imagecolorallocate ( $this->image_pointer , "0x".$color[0] , "0x".$color[1] , "0x".$color[2] ) ;
} // end offunction set_color ()
function fill ($fill_x = 0 , $fill_y = 0)
{
imagefill ( $this->image_pointer , $fill_x, $fill_y , $this->color_pointer );
}
function add_string ( $text , $font_type , $location_x = 0 , $location_y = 0 , $method = 'h' )
{ // start of function function add_string ( )
if ($method == 'h')
{
imagestring ($this->image_pointer , $font_type, $location_x , $location_y, $text, $this->color_pointer );
}
else if ($method == 'v' )
{
imagestringup ($this->image_pointer , $font_type, $location_x , $location_y, $text, $this->color_pointer );
}
} // end offunction function add_string ( )
function add_ttstring ()
{ // start of function add_tstring ()
} // end of function add_tstring ()
// first and last
function set_line( $f_x , $f_y , $l_x , $l_y )
{ // start of function set_line()
imageline($this->image_pointer ,$f_x , $f_y , $l_x , $l_y , $this->color_pointer );
} // end of function set_line()
// first and last
function rect( $x , $y , $width , $height , $type = "fill" )
{ // start of function rect()
if ( $type == "fill" )
{
imagefilledrectangle($this->image_pointer ,$x , $y , $x + $width , $y + $height , $this->color_pointer );
}
else if ( $type == "border" )
{
imagerectangle($this->image_pointer ,$x , $y , $x + $width , $y + $height , $this->color_pointer );
}
} // end of function rect()
function create_image ($method = 'jpeg' , $create_file = NULL , $quality = 100 )
{ // start of function create_image ()
if ( $create_file != NULL )
{ // set the file name
$create_file = $create_file.".".$method ;
}
if ( $method == 'png' )
{
header ('Content-type: image/png');
header ('Content-Disposition: inline; filename = "myfile.png"');
imagepng ($this->image_pointer , $create_file , $quality );
}
else if ( $method == 'jpeg' )
{
header ('Content-type: image/jpeg');
header ('Content-Disposition: inline; filename = "myfile.jpeg"');
imagejpeg ($this->image_pointer , $create_file , $quality );
}
imagedestroy ($this->image_pointer);
} // end of function create_image ()
} // end of class GD
?>
example of use:
Code: <?php
// /public_html/emp/
include ('GD.php');
$object = new GD (400,400);
$object->set_color ("#976686");
$object->fill ();
$object->set_color ("#999999");
$object->add_string('hello',5,50,50);
$object->create_image('jpeg');
?>
In wamp the picture is ok how ever on the remote servers it is black.
Thanks for the help
CURL XML Request [From C to PHP]
Hi, I need some help converting this into something that will work with PHP.Code:
PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn how the ARRAY function worked, nor in what instances to use it. Now I've stumbled upon the jCarousel
does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how
Why does my crawler script suddenly end with no error?
Hi.I have written a web crawler script. It will visit a large number of URL's with cURL.After around 2-3 minutes of running, it will just stop, with no error output or notices.I have these
help with email script...
hey I need help with my mail scriptwhen the form on http://www.mcgdesignstudio.com/contact.html is filled out, it send the from with no errors.. however i never receive it.. my hosting company have
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html "select form" and set value to "Between x and x" I get a resource error when
How to read posted binary data from a mobile device and post it to a web server?
Here is the senario...I have a mobile device (MD) that posts binary data to a Web Server (WS1) and that Web Server (WS1) posts that binary data (from the MD) to another Web Server (WS2).(MD)
SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built in???
Time script, set to my time zone?
I am using this line to get the date and timeCode: $time = date(F." ".d.", ".Y." ".g.":".i.":".sa,time());How could I change this to my time zone here
Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web browser. http://127.0.0.1:12345/I assumed that the following would detect that something was trying to