【问题标题】:I trying to view photo from a RETS with PHRETS我试图从带有 PHRETS 的 RETS 中查看照片
【发布时间】:2021-02-10 09:19:29
【问题描述】:

这是我的代码
$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}' />";
}

结果 致命错误:未捕获错误:调用未定义的方法 PHRETS\Models\BaseObject::Data()

$objects 的 var_dump

...
 [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]."
      }
    }

和

 $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
    }
  }

和

$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
    }
  }
}

没有找到数据数组 剂量这意味着我无法获得照片的帐户 并使用 L_ListingID 结果获取照片 enter image description here

【问题讨论】:

    标签: php rets phrets


    【解决方案1】:

    有些服务器不直接提供图片,所以你需要使用他们给你的 URL:

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

    您必须使用该 URL 来获取实际图像。

    【讨论】:

    • 尝试将其作为 img 的来源,但它没有在查询循环中显示图片 img-st10.paragonrels.com/ParagonImages/Property/ST10/BCRES/…"> 但图片不会显示
    • @VanDupio 你需要联系 MLS 并询问他们从 RETS 系统获取图像的支持程序是什么。
    猜你喜欢
    • 2023-03-19
    • 2012-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多