Hey there,
I've found a semi-acceptable solution that uses temporary files, here's a snipet:
// Save the thumbnail to a temporary file
$tmp_filename = "/some/tmp/dir/tmp.jpg";
imagejpeg($image_thumb,$tmp_filename);
// Try to open the file
$fp = @fopen($tmp_filename, "r");
if (!$fp) {
unlink($tmp_filename);
return FALSE;
}
// Extract the picture data
$bin_data = addslashes(fread($fp, filesize($tmp_filename)));
I would still like to do the job without using tmporary files, but this will do for now.