i'd seperate the text data and image locations into two tables. then in the text reference the images like so: <1> or something.
pull the images (don't store the binary data, just the locations to the images) using a id key that ties the images to the text article and number the images. replace the number index in the text <1> with an image src (a preg and a backreference) and send the text to the browser. this way you could have:
My Text Article <1> <-- insert image #1 for the text
This is a test of mixing images and text. See <2> how successful it is? Ah, better luck next time.
<3> <-- select images.id from images where images.article_id = articles.id;