Lets say I have this XML:
images/thumbs/002.jpg 002
Use this:
$project = $xml_object->xpath("//photo[filename='$image_id']");