Dynamic Images

Any other shit you want to talk about.

Dynamic Images

Postby Webase » 2005-06-04 11:04 am

I keep getting this error: The image “http://www.webasenet.com/test2.php” cannot be displayed, because it contains errors. when trying to run this script:
Code: Select all
<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreate(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>


Any idea? N/m, got it working. :D
Image
Webase
Member
 
Posts: 14
Joined: 2005-04-10 03:18 pm

Center Text in Dynamic Images

Postby Webase » 2005-06-05 08:44 am

Is centering a text on a dynamic image possible?
Image
Webase
Member
 
Posts: 14
Joined: 2005-04-10 03:18 pm

Postby Jeremy » 2005-06-05 01:58 pm

i'm not sure... try asking at sitepoint or something, you'll get more of a response there.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA


Return to Other

Who is online

Users browsing this forum: Google [Bot] and 1 guest