Need help with dynamic player signatures. [PHP and MySQL]
#3

Make sure your image work without the mysql information.

By the way, i also had problems with imagecreatefrompng , so i created a true color one instead, and placed the image above it with imagecopy.

Here is a simple working PHP image:

PHP код:
// Establish image factors:
    
$font_size 18// Font size is in pixels.
    
$font_file 'Tahoma.ttf'// This is the path to your font file.


    // Create image:
    
$image imagecreatetruecolor(450110); // Create a truecolor image 450x110

    // Allocate text and background colors (RGB format):
    
$bg_color imagecolorallocate($image000);
    
$text_color imagecolorallocate($image,237,176,07);

    
// Fill image:
    
imagefill($image00$bg_color);

    
// Bg IMG
    
$bg_image imagecreatefrompng("bg.png"); // Load PNG image
    
imagecopy($image,$bg_image,0,0,0,0,450,110); // Then copy it into our image

    // Add TrueType text to image:
    
imagettftext($image$font_size010060$text_color$font_file"This is a test!");

    
// Generate and send image to browser:
    
header('Content-type: image/png');
    
imagepng($image);

    
// Destroy image in memory to free-up resources:
    
imagedestroy($image); 
Hope i helped you.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)