While not the most elegant solution and with many more out there, you could use PHP's str_replace
and do something such as this.
<?php
$string = 'The person name Abdul <img src="images/abdul.jpg" alt="abdul"/>.....';
$string = str_replace('src="images/', 'src="../../images/', $string);
echo $string;
?>
Note: The only reason I added src="
infront of the images part is to help eliminate chances where an image may be misnamed. You could instead use this.
$string = str_replace('images/', '../../images/', $string);
I would recommend not saving items in a database as relative paths. Save just the image names or even better, the full URL of the image and echo it. It's cleaner and a more robust solution for large data (using CDNs, etc).
More on str_replace
here