In this code when action == convert there are some things that happen. The only important thing is that when that action is sent, the headers there must do their work; like sending ABA.jpg to the client. This allready works (after experimentating with ob_start() and ob_flush(). The problem is, after downloading the file is not readable (it has size 29 kb when downloaded)
When I use these 4 header codes in a blank php page it worls but not in combination with this code::
<?php ob_start(); $image="motor.jpg";echo"
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Untitled Document</title>
<link href='../../../Documents%20and%20Settings/Henk%20Jan/Mijn%20documenten/I-Bank/smarteye.css' rel='stylesheet' type='text/css'>
</head>
<body>
<table width='771' border='0' cellpadding='0' cellspacing='0'>
<!--DWLayoutTable-->
<tr>
<td height='22' colspan='4' valign='top'><!--DWLayoutEmptyCell--> </td>
<td width='181'> </td>
<td width='251'></td>
</tr>
<tr>
<td height='248' colspan='5' align='center' valign='top'><img src='$image' width='339' height='248' align='absmiddle'></td>
<td></td>
</tr>
<tr>
<td width='158' height='32' valign='middle' class='titel'>Origineel bestand:</td>
<td colspan='3' valign='middle'>$image</td>
<td align='center' valign='middle'> <input type='submit' name='Submit' value='Download'></td>
<td></td>
</tr>
<tr>
<td height='32' valign='middle' class='titel'>Converteer extensie</td>
<form action='$PHP_SELF' method='post'>
<input type ='hidden' name= 'action' value='convert'>
<td colspan='3' valign='top'><select name ='format'>
<option value='GIF'>GIF</option>
<option value='JPG'>JPG</option>
<option value='PNG'>PNG</option>
<option value='TIFF'>TIF</option>
<option value='PDF'>PDF</option>
<option value='MPEG'>MPEG</option>
<option value='EPS'>EPS</option>
<option value='PICT'>PICT</option>
<option value='AVI'>AVI</option>
<option value='PSD'>PSD</option>
<option value='HTML'>HTML</option>
<option value='TXT'>TXT</option>
</select></td>
<td align='center' valign='middle'> <input type='submit' name ='convert' value='converteer'></td>
<td></td>
</form>
<tr>
<td height='80' colspan='2' valign='top'><table width='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>
<!--DWLayoutTable-->
<tr>
<td height='16' colspan='2' align='center' valign='top' class='titel'>Web-conversie
(72 DPI)</td>
</tr>
<tr>
<td width='138' height='31' align='center' valign='middle'>
<form action='print $PHP_SELF; ?>' method='post'>
<input type ='hidden' name= 'action' value='convert_72'>
<select name='con_format'>
<option value='JPG'>JPG</option>
<option value='PDF'>PDF</option>
</select></td>
<td width='112' align='center' valign='middle'> <select name='con_res'>
<option>640 * 480</option>
<option>800 * 600</option>
<option>1024*768</option>
<option>1400 *1050</option>
<option>thumbnail</option>
<option>pasfoto</option>
</select></td>
</tr>
<tr>
<td height='33' colspan='2' align='center' valign='middle'> <input type='submit' name='Sconvert_72' value='Convert72'></td>
</tr>
</table></td>
<td width='15'> </td>
<td colspan='2' valign='top'><table width='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#CCCCCC'>
<!--DWLayoutTable-->
<tr align='center'>
<td height='19' colspan='2' valign='top' class='titel'> Print -conversie
(144 DPI)</td>
</tr>
<tr>
<td width='129' height='30' align='center' valign='middle'> <select name='select3'>
</select></td>
<td width='126' align='center' valign='middle'> <select name='select5'>
</select></td>
</tr>
<tr align='center' valign='middle'>
<td height='34' colspan='2'> <input type='submit' name='Submit32' value='Submit'></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height='730'> </td>
<td width='92'> </td>
<td> </td>
<td width='74'> </td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>";?>
<?php ob_start();
$error1= "echo <script>alert ('Bestand niet meer aanwezig')</script>";
$error2= "echo <script>alert ('Origineel bestand gelijk aan bestand dat u wilt converteren')</script>";
$confirm1="Bestand succesvol verzonden";
$ext = $format;
$gebruiker="gebruker";
$time=time();
if ($_POST['action'] == "convert") {
$convert=`convert $image $time.$format`;
$bestandsnaam= $time.".$format";
ob_flush();
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename="aba.jpg"');
readfile('aba.jpg');
}
?>