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);
  

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.