Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why image not showing ?

Status
Not open for further replies.

jonybd

Programmer
Joined
Nov 3, 2002
Messages
166
Location
BE
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/htm; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<?php
if ( $_REQUEST['submitok'] != &quot;Submit&quot; )
?>
<a href=&quot;one.htm&quot; >view the code</a>
<form method=&quot;post&quot; action=&quot;<?=$_SERVER['PHP_SELF'] ?>&quot;>
<input type=&quot;text&quot; name=&quot;textfield&quot;>
<input type=&quot;submit&quot; name=&quot;submitok&quot; value=&quot;Submit&quot;>
</form>
<?php
$pr = $_POST['textfield'];
// header(&quot;Content-type: image/jpeg&quot;);
$im = imagecreate(400,30);
$white = imagecolorallocate($im, 255,255,255);
$black = imagecolorallocate($im, 0,0,0);

imagettftext($im,11, 0, 10, 20, $black, &quot;D:\Windows\Fonts\Impact.ttf&quot;, $pr);
imagejpeg($im,&quot;pic.jpg&quot;);
imagejpeg($im);
imagedestroy($im);

?>
<img src=&quot;pic.jpg&quot;>
</body>
</html>
 
It's because you don't output the image as some kind of inline function of your HTML page. HTTP provides, with the exception multipart encoding, for only one MIME type to be output at a time. Basically, you have to either output HTML or an image. You can't do both at once.

You can, however, use an <IMG> tag with its &quot;src&quot; attribute pointing to a PHP script. Reorganize your code into two separate scripts. One to output the HTML, another to output the image. Remember that the image-output script's going to have to set the appropriate &quot;Content-type&quot; header.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
thanks but i am using as the following:

<html>
<head>
<title>img mysql save</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/htm; charset=iso-8859-1&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+&quot;.location='&quot;+selObj.options[selObj.selectedIndex].value+&quot;'&quot;);
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot;>
<form method=&quot;post&quot; action=&quot;<?=$_SERVER['PHP_SELF']; ?>&quot; >
<table width=&quot;45%&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;44%&quot;><font color=&quot;#FFFFFF&quot;>Input Text: </font></td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;textfield&quot; value=&quot;Class V1.0 Coder (jonybd)&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;><font color=&quot;#FFFFFF&quot;>Select Font Color: </font></td>
<td width=&quot;56%&quot;>
<select name=&quot;tcol&quot;>
<option value = &quot;black&quot;>black</option>
<option value = &quot;white&quot;>white</option>
<option value = &quot;red&quot;>red</option>
<option value = &quot;green&quot;>green</option>
<option value = &quot;blue&quot; selected>blue</option>
<option value = &quot;yellow&quot;>yellow</option>
</select>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;><font color=&quot;#FFFFFF&quot;>Select Font: </font></td>
<td width=&quot;56%&quot;>
<select name=&quot;tfont&quot;>
<option value = &quot;impact&quot; selected>impact</option>
<option value = &quot;roman&quot;>roman</option>
<option value = &quot;script&quot;>script</option>
</select>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;><font color=&quot;#FFFFFF&quot;>Select BackGround Color: </font></td>
<td width=&quot;56%&quot;>
<select name=&quot;bgcol&quot;>
<option value = &quot;black&quot; selected>black</option>
<option value = &quot;white&quot;>white</option>
<option value = &quot;red&quot;>red</option>
<option value = &quot;green&quot;>green</option>
<option value = &quot;blue&quot;>blue</option>
<option value = &quot;yellow&quot;>yellow</option>
</select>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;><font color=&quot;#FFFFFF&quot;></font></td>
<td width=&quot;56%&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submitnow&quot;>
</td>
</tr>
</table>
</form>
<?php
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
if ($_REQUEST['submit'] == 'submitnow')
{
$txt = $_REQUEST['textfield'];
$tf = $_REQUEST['tfont'];
$tc = $_REQUEST['tcol'];
$bg = $_REQUEST['bgcol'];

include(&quot;func.php&quot;);
// function use
// inputtxt, Font , Color ,Size , BG , BG W , H , Tleft, ttop, angel
imgView($txt, $tf , $tc, 15 , $bg,200, 100, 5 , 150/2 , 0);
}
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
?>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;<?=$_SERVER['PHP_SELF']; ?>&quot;>
<table width=&quot;49%&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr>
<td width=&quot;44%&quot;>mySql Database Server</td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;srv&quot; value=&quot;127.0.0.1&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;>mySql Database Name</td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;db&quot; value=&quot;atml&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;>mySql Database Username</td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;u&quot; value=&quot;root&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;>mySql Database Field name</td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;fld&quot; value=&quot;pic&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;>mySql Picture Path for save</td>
<td width=&quot;56%&quot;>
<input type=&quot;text&quot; name=&quot;p&quot; value=&quot;pic.jpg&quot;>
</td>
</tr>
<tr>
<td width=&quot;44%&quot;>&nbsp;</td>
<td width=&quot;56%&quot;>
<input type=&quot;submit&quot; name=&quot;dbsave&quot; value=&quot;save now&quot;>
</td>
</tr>
</table>
</form>
<?php
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/

if ($_REQUEST['dbsave'] == 'save now')
{
$one = $_REQUEST['srv'];
$two = $_REQUEST['db'];
$three = $_REQUEST['u'];
$four = $_REQUEST['fld'];
$five = $_REQUEST['p'];

include(&quot;func.php&quot;);
// function use
// function imgSave($srv, $db , $u, $fld , $p)
imgSave($one, $two , $three,$four , $five);
}
/*
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
*/
?>
<p>&nbsp;</p>

</body>
</html>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top