简体   繁体   中英

I trying to view photo from a RETS with PHRETS

this my codes
$objects = $rets->GetObject('Property','Photo','262394501','*',0);

foreach ($objects as $object)
{      
        $contentType=$object->GetcontentType();
        $base64 = base64_encode($object->Data());
echo "<img src='data:{$contentType};base64,{$base64}' />";
}

results Fatal error: Uncaught Error: Call to undefined method PHRETS\\Models\\BaseObject::Data()

a var_dump of $objects

...
 [19]=>
    object(PHRETS\Models\BaseObject)#87 (10) {
      ["content_type":protected]=>
      string(8) "text/xml"
      ["content_id":protected]=>
      string(9) "262394501"
      ["object_id":protected]=>
      string(2) "20"
      ["mime_version":protected]=>
      NULL
      ["location":protected]=>
      NULL
      ["content_description":protected]=>
      NULL
      ["content_sub_description":protected]=>
      NULL
      ["content":protected]=>
      string(77) "<RETS ReplyCode="20409" ReplyText="Object Unavailable [262394501:20]." />

"
      ["preferred":protected]=>
      NULL
      ["error":protected]=>
      object(PHRETS\Models\RETSError)#96 (2) {
        ["code":protected]=>
        int(20409)
        ["message":protected]=>
        string(34) "Object Unavailable [262394501:20]."
      }
    }

and

 $objects = $rets->GetObject('Property','Photo','262394501','*',1);
    var_dump($objects);

....
[19]=>
    object(PHRETS\Models\BaseObject)#72 (10) {
      ["content_type":protected]=>
      string(8) "text/xml"
      ["content_id":protected]=>
      string(9) "262394501"
      ["object_id":protected]=>
      string(2) "20"
      ["mime_version":protected]=>
      NULL
      ["location":protected]=>
      string(168) "http://img-st10.paragonrels.com/ParagonImages/Property/ST10/BCRES/262394501/19/0/0/4cf9ac732b4cae04d8664c68e65e8d79/15/4f9210b40832eaa2f147bb3f3378ed49/262394501-19.JPG"
      ["content_description":protected]=>
      NULL
      ["content_sub_description":protected]=>
      NULL
      ["content":protected]=>
      string(59) "<RETS ReplyCode="0" ReplyText="Operation Successful" />

"
      ["preferred":protected]=>
      NULL
      ["error":protected]=>
      NULL
    }
  }

and

$objects = $rets->GetObject('Property','Photo','262394501',1,1);
var_dump($objects);
object(Illuminate\Support\Collection)#40 (1) {
  ["items":protected]=>
  array(1) {
    [0]=>
    object(PHRETS\Models\BaseObject)#33 (10) {
      ["content_type":protected]=>
      string(8) "text/xml"
      ["content_id":protected]=>
      string(9) "262394501"
      ["object_id":protected]=>
      string(1) "1"
      ["mime_version":protected]=>
      string(3) "1.0"
      ["location":protected]=>
      string(164) "http://img-st10.paragonrels.com/ParagonImages/Property/ST10/BCRES/262394501/0/0/0/08bdc26221362780ab07cb04339d48f1/15/4f9210b40832eaa2f147bb3f3378ed49/262394501.JPG"
      ["content_description":protected]=>
      NULL
      ["content_sub_description":protected]=>
      NULL
      ["content":protected]=>
      string(37) "<RETS ReplyCode="0" ReplyText="" />
"
      ["preferred":protected]=>
      NULL
      ["error":protected]=>
      NULL
    }
  }
}

there no Data array found dose it mean the account i not able to get Photo and use the L_ListingID result to fetch the photo enter image description here

Some servers don't provide images directly, so you will need to use the URL they give you:

"location":protected]=>
  string(164) "http://img-st10.paragonrels.com/ParagonImages/Property/ST10/BCRES/262394501/0/0/0/08bdc26221362780ab07cb04339d48f1/15/4f9210b40832eaa2f147bb3f3378ed49/262394501.JPG"

You'll have to use that URL to get the actual image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM