Ok, I think I gave you a bum steer on that last post. What you really want here is preg_match() - http://us4.php.net/manual/en/function.preg-match.php . This made me realize that I suck at the regex stuff so I decided to give this one a go. I am probably going to over explain a bit since I am learning as I am going.
Let's assume that the original content of the db is in a variable called $image_info:
$image_info='<IMG alt="" hspace=0 src="http://images/btn-home.png" align=baseline border=0>';
and we want to trimm that down and be able to call the shortened image info as $image_pdf. We want to start our new string at the src="http: since we know that the row should contain this only once and it should be at the beginning of the url (we are going to come back and add the <IMG later on). Since the url in the db will end with a quotation mark, we can use that as our end. So we need to tell our regex to match every pattern that starts with src="http: and ends with ".
So here is the raw regex pattern:
/src="http:.+"/
And to break that down:
/ -starts our pattern
src="http: -text string we want to match
.+ -plus any (.) character or string (+) of characters
" -text string we want to match
/ -end pattern
Now, to use this in a script we need to escape any non alphanumeric character that we want taken as a literal rather than an operator (", = and : in our case). You don't actually have to escape ALL of them, but it certainly doesn't hurt to, so we might as well:
/src\=\"http:.+\"/
Now we feed that into our preg_match function, in the following format - preg_match(pattern, string or variable to search, output [as an array]):
preg_match('/src\=\"http\:.+\"/', $image_info, $image_url);
echo $image_url[0]; //remember the [] - this is an array
reveals the string "src="http://images/btn-home.png". Perfect. Now we concentate the IMG tags and we are all set:
$image_pdf= '<IMG '.$image_url[0].'>';
I tested it using several different strings and string types for the url and it worked fine. I found a great regex tutorial at http://www.zend.com/zend/tut/tutorial-delin2.php if you want to learn more.
Hope that helps!