0

Hi

I have created a php script for writing text in a image. Its working fine. But when I include a file it doesnot generate the image. what is the problem? my code is as bello

<?php
header ("Content-type: image/jpeg");
$im = imagecreatefromjpeg("photo.jpg");
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
$sn='s/n:- '.$_GET['serial'];
imagettftext ( $im , 13 , 0 , 290 ,180 , $textColor , 'century.ttf' , 'tushar' );
imagettftext ( $im , 13 , 0 , 330 ,275 , $textColor , 'century.ttf' , $sn );
imagejpeg($im);
?>

the above code works very fine. But when I use below code it doesnot work

<?php
session_start();
include 'sql.php';
header ("Content-type: image/jpeg");
$im = imagecreatefromjpeg("lottery.jpg");
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
$sn='s/n:- '.$_GET['serial'];
imagettftext ( $im , 13 , 0 , 290 ,180 , $textColor , 'century.ttf' , 'tushar' );
imagettftext ( $im , 13 , 0 , 330 ,275 , $textColor , 'century.ttf' , $sn );
imagejpeg($im);
?>

I need to include sql.php file to call functiong and make 'tushar' in line 7 as variable. Please help me

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by arctushar
0

There are some possibilities:
1. The include cannot find the file
2. The included file has syntax errors
3. The included file outputs some text, which causes the header to fail

Check your error log for more information.

0

my included sql file code is

<?php
function serial2name($serial){
    return $name;
}
?> 
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.