views:

37

answers:

2

Hi,

I have BLOB field in MySql table with text and image inside, is there any way to extract out only text or only images?

  $query  = "SELECT id, date, blob, FROM table ORDER BY id  DESC ";
    $result = mysql_query($query);

    while($row = mysql_fetch_assoc($result))         {
    echo 

"<div class=all>
   "<ul class=id>{$row['id']}</ul>".
   "<ul class=date>{$row['date']}</ul>" .
  "<ul class=blob_image><IMAGE>{$row['blob']}</IMAGE></ul>".
  "<ul class=blob_text><TEXT>{$row['blob']}</TEXT></ul>
 </div>";
} 

mysql_free_result($result);

Thank you

A: 

Sure there is: You could analyze a blob's content and decide whether you are handling text or an image. For this purpose, you have to be clear about the encoding of the text as well as the format of the images to distinguish between them accurately. To be even more accurate, I could analyze the characters of possible text and reject the "text case" if "invalid" characters are included (dependent on the semantics and context which requires background knowledge).

Flinsch
A: 

@Flinsch

can you please ponit me how, can I analyze blob content?