According to the PHRETS documentation for GetObject, the last argument in GetObject, $location, can either be a "0" or "1". "1" returns the image's URL string and "0" returns the binary image data.
#1 Encoding the image data and outputting to browser without saving to a file. From this SO question
$photos = $rets->GetObject("Property", "Photo", $sysid, "*", 0);
foreach ($photos as $photo)
{
if ($photo['Success'] == true)
{
$contentType = $photo['Content-Type'];
$base64 = base64_encode($photo['Data']);
echo "<img src='data:{$contentType};base64," . $base64 . "' />";
}
else
{
echo "({$photo['Content-ID']}-{$photo['Object-ID']}): {$photo['ReplyCode']} = {$photo['ReplyText']}<br />";
}
}
#2 Saving the image to a file and then displaying it. From PHRETS
$photos = $rets->GetObject("Property", "Photo", $sysid, "*", 0);
foreach ($photos as $photo)
{
if ($photo['Success'] == true)
{
file_put_contents("image-{$listing}-{$number}.jpg", $photo['Data']);
echo "<img src='image-{$listing}-{$number}.jpg' />";
}
else
{
echo "({$photo['Content-ID']}-{$photo['Object-ID']}): {$photo['ReplyCode']} = {$photo['ReplyText']}<br />";
}
}