I am trying to download images from new RETS
CRMLS
$photos = $rets->SearchQuery("Media","Media",$lid, array('Limit' => 'none', 'Select' => "MediaOrder,MediaURL"));
foreach ($photos as $photo)
{
if ($photo['Success'] == true)
{
file_put_contents("../images/{$photo['Content-ID']}-{$photo['Object-ID']}.jpg", $photo['Data']);
$count++;
}
}
this is not working
If you want to download the images from the Property class, you can use this rets function
$rets->GetObject("Property", "Photo", $listingId, "*", 1);
This will return the array of images associated with the particular listingId
as image url.
If you want to download as binary image files then you can use the last parameter as '0'
, instead of '1'
. [ '1' is for getting public image Urls]
If the image is to be downloaded from the Media class then you can use the same function with Media
as the class. And you should first get the listing Id from the Property class.