[PHP]<?php
mysql_connect("localhost","root","12345");
mysql_select_db("pyz");
$str_sql="select * from xyz where id= '".$_GET['Id']."'";;
$Colloquiums1 = array();
$i=0;
$res_id=mysql_query($str_sql);
while ($sub_row=mysql_fetch_array($res_id)) {
$tmp1 = array(
I am storing it here
);
$Colloquiums1[$i++] = $tmp1;
}
$ID=$Colloquiums1[0]['ID'];
$nid=$ID;
$name=strtoupper($Colloquiums1[0]['name']);
$picname=$Colloquiums1[0]['picname'];
$address=$Colloquiums1[0]['address'];
// subject
$subject = 'admitcard';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<div id="textcontent">
<h3>Admit Card</h3>
<table align="center" width="100%" border="1" cellspacing="2" cellpadding="2" id="img1">
<tr>
<td align="left">Ref=$ID</td>
</tr>
</table>
<table align="center" width="100%" border="0" cellspacing="2" cellpadding="2" id="img1">
<tr>
<td>Name</td>
<td>:</td>
<td><b>' . $name . '</b></td>
</tr>
<tr>
<td>pic</td>
<td>:</td>
<td><p>'. print("<img src='admitcardpic.php?Id='". $ID ."'>") .'</p></td>
</tr>
</table>
<table>This is a automated email(admitcard) generated.Copyright@IIA.</table>
</body>
</html> ';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: xyz@gmail.com, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: webmaster <webmaster@iiap.res.in>' . "\r\n";
$headers .= 'Cc: testcom' . "\r\n";
$headers .= 'Bcc: cc@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
[/PHP]
this is the admitcardpic.php where pic is generated
[PHP]<?php
error_reporting(E_ALL);
$link = mysql_connect("localhost", "root", "12344") or die("Could not connect: " . mysql_error());
mysql_select_db("xyz") or die(mysql_error());
$sql = "SELECT Pic FROM phd WHERE ID='".$_GET['Id']."'";
//'".$_GET['Id']."'";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
header("Content-type: image/jpeg");
$test=mysql_result($result,0);
$desired_width = 85;
$desired_height = 110;
$im = imagecreatefromstring($test);
$new = imagecreatetruecolor($desired_width, $desired_height);
$x = imagesx($im);
$y = imagesy($im);
imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y);
imagedestroy($im);
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Content-type: image/jpeg');
imagejpeg($new, NULL, 85);
imagedestroy($new);
// echo $test;
mysql_close($link);
?>[/PHP]
but the image is not coming rest of details is coming