Maybe it would by fine to split.
if (preg_match("/img/i",$content))
{
..
$pattern = '/src="([^"]+)"/i';
..
Then you will get exact file name. Height of div should be set.
Whole code - matching all images:
if (preg_match("/img/i",$content))
{
if (preg_match_all('/src[ ]?=[ ]?"([^"]+)"/i',$content,$matches))
{
foreach ($matches[1] as $i => $match)
{
$replacement = '<div class="full-image" style="background-image: url(\'' . trim($match) . '\')"></div>';
$content = preg_replace("~(<img(.*){$matches[0][$i]}[^>]+>)~i",$replacement,$content);
}
}
}
! div height must be set