<?php
$contents = 'This is test content and an image tage after that. <img title="Dummy Image" src="http://www.warepin.com/wp-content/uploads/2010/03/sample-proposals-for-computer-hardware.jpg" alt="DummyImage" />
You will get the image from the string';
$pos = stripos($contents,'<img');
$posimg = stripos($contents, ">", $pos);
$final = substr($contents, $posimg+1);
echo $final; // Total content
$len = strlen($final);
$img = substr($contents, 0, -$len);
echo $img; // The image
?>