Hello everyone
I've got this script adapted to create thumbnails from the blob field, it works excellent, the problem is that when I try to paste it inside a large html with more php scripts and things it gives as a result "cannot add header info, headers already sent by..." 😕
Lots of people say that you must not have code written before, so, what's the use of PHP if you can't embbed it into HTML? (of course I've followed the rule of not blank spaces)
Other ones say using ob_start() an "end" are useful but in my case nothing is working.
Any help would really be apreciated, here's the code:
<?
$data = $row_Recordset1["fileContents"];
$size = 115; // new image height
$src = imagecreatefromstring ($data);
$width = imagesx($src);
$height = imagesy($src);
$aspect_ratio = $height/$width;
if ($height <= $size) {
$new_w = $width;
$new_h = $height;
} else {
$new_h = $size;
$new_w = abs($new_h / $aspect_ratio);
}
$img = imagecreate ($new_w,$new_h);
imagecopyresized($img,$src,0,0,0,0,$new_w,$new_h,$width,$height);
// is in the header below that I get the error!!!!!!!
ob_start();
header('Content-Type: image/jpeg');
// determine image type and send it to the client
imagejpeg($img, '', 90);
ob_end_flush();
imagedestroy($img);
?>
Any Idea?, any?, thanks! Hope this code could be useful for someone, it has been a lot of research for me