Jump to content

error when i combine imagecopymerge and imagettftext functions...


yekis

Recommended Posts

i get ascii characters when i preview my file in a browser...don't know what's wrong with my code....tnx

 

 

<?php


//define string


   $font = "ariblk.ttf"; 
  
  // Defining the background image.
  $background = imagecreatefrompng("background.png"); 

  // colors to possibly be used later
  $white = imagecolorallocate($background, 255, 255, 255);
  $almostWhite = imagecolorallocate( $background, 247, 247, 247 );

  // Defining the icons to be added or combined.
  $insert = imagecreatefrompng("logo.png");


  // Get icon width and hight for later use
  // all icons are the same size
  $insert_x = imagesx($insert); 
  $insert_y = imagesy($insert); 
  
  // Combine the images into a single output image.
  imagecopymerge($background,$insert,426,45,0,0,$insert_x,$insert_y,99); 
  
  // Add id text
  imagettftext( $background, 12, 0, 35, 76, $almostWhite, $font, "TEXT");

  // Output the results as a png image, to be sent to users browser. 
  imagepng($background); 
  imagedestroy($background);
  

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.