Fix PHP notice in from_attachment method

Add a logic to cope with images in posts with protocol independent and root relative urls