Jump to content

Help Creating an Image!?!?!


adam84

Recommended Posts

I want to add some text onto an image.

Sometimes I either get nothing returned or I get a shit load of garbage returned. Garbage in the form of little question mark symbols and other crap like that.

 

PHP File - show Tickets

include("createImage.php");

while( $row = mysql_fetch_array( $r ) ){
         echo generateTicket( $row['ticketNumber'] ) . "<br /><br />";
}

 

PHP - createImage.php

<?
header("Content-type: image/jpeg");

function generateTicket( $ticketNum ){

	$imageFile = "images/ticket.jpeg";

	if( file_exists( $imageFile ) ){

		$im = @imagecreatefromjpg( $imageFile );

		$text_color = imagecolorallocate( $im, 0, 0, 0 );

		imagestring( $im, 6, 25, 150, $ticketNum, $text_color );

		imagejpeg( $im );
	}else 
		echo 'error';
}

?>

Link to comment
https://forums.phpfreaks.com/topic/214257-help-creating-an-image/
Share on other sites

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.