GetObject - Multiple images

487 views
Skip to first unread message

Kevin Korb

unread,
Sep 29, 2009, 4:49:52 PM9/29/09
to PHRETS
Wanting to download many images at the same time, and I'm not able to
really make that work yet. IE, I'd like to download all the images at
the same time using the GetObject method.

$images = $Phrets->GetObject('Property', 'Photo', '80054327', '*');
print_r($images);

returns:
Array
(
)


However
$images = $Phrets->GetObject('Property', 'Photo', '80054327', 1);
print_r($images);

returns:
Array
(
[0] => Array
(
[Success] => 1
[Content-ID] => 80054327
[Object-ID] => 1
[Content-Type] => image/jpeg;charset=utf-8
[MIME-Version] => 1.0
[Content-Description] => 80054327
[Length] => 16549
[Data] => ÿØÿà� JFIF� �`�`��ÿÛ�C�

And so on.

Then when I go to specify which photos I get back in my object id, the
data doesn't seem to get back as expected.

IE.
$resources = $Phrets->GetObject('Property', 'Photo', '80054327',
'1,2,3,4,5');
foreach($resources AS $key => $resource) {
echo "Woo hoo resource $key<br>";
print_r($resource);
}

I only get:

Woo hoo resource 0

Array
(
[Success] => 1
[Content-ID] => 80054327
[Object-ID] => 1
[Content-Type] => image/jpeg;charset=utf-8
[MIME-Version] => 1.0
[Content-Description] => 80054327
[Length] => 108070
[Data] => ÿØÿà� JFIF� �`�`��ÿÛ�C�

$.' ",# (7),01444 '9=82<.342ÿÛ�C
....lots of stuff here.

Now I know it's returning the 5 images back, it's just that phrets
isn't parsing it correctly. I found the string JFIF 5 times in the
$resources[0]['data'] property.

I'm using PHP 5.3.0, I'm not getting any errors/warnings/notices in my
logs either.

Thanks.

Troy Davisson

unread,
Sep 29, 2009, 4:52:05 PM9/29/09
to phr...@googlegroups.com
What's the RETS login URL of that?  Is it MARIS?

Kevin Korb

unread,
Sep 29, 2009, 4:59:11 PM9/29/09
to PHRETS
Yes, it is MARIS.

http://marisrets.com/rets/login

On Sep 29, 3:52 pm, Troy Davisson <troy.davis...@gmail.com> wrote:
> What's the RETS login URL of that?  Is it MARIS?
>

Kevin Korb

unread,
Sep 29, 2009, 5:03:19 PM9/29/09
to PHRETS
Rets version: RETS/1.7.2 Not sure if that helps.

Thanks!

Troy Davisson

unread,
Sep 29, 2009, 5:06:31 PM9/29/09
to phr...@googlegroups.com
They have a broken implementation of GetObject and are aware of it.  I'll send you an alternate PHRETS scipt in a bit which temporarily makes it so you can get the images back (and when they fix it, you should be able to drop in the 1.0rc1 right over it).

If anyone else is working with MARIS and having trouble with GetObject, let me know off-list and I'll try and help where I can.

Kevin Korb

unread,
Sep 29, 2009, 6:25:00 PM9/29/09
to PHRETS
Does the GetObject method get my multiple images in one request, or
does it do it getting one photo per request and then putting them back
into an array for me on my side?

The problem we're having is the total images for a full image import
totals around 6 or 7 GBs just to download the data and if we have to
make separate requests for each image the latency really effects us
and we're only able to download about 75Meg/hr. So if the GetObject
can download lots of images in a single request that should help out,
otherwise is there another way to accomplish this?

I apologize, I'm new to the RETS system. Thanks for your help.

-Kevin Korb

On Sep 29, 4:06 pm, Troy Davisson <troy.davis...@gmail.com> wrote:
> They have a broken implementation of GetObject and are aware of it.  I'll
> send you an alternate PHRETS scipt in a bit which temporarily makes it so
> you can get the images back (and when they fix it, you should be able to
> drop in the 1.0rc1 right over it).
>
> If anyone else is working with MARIS and having trouble with GetObject, let
> me know off-list and I'll try and help where I can.
>

Troy Davisson

unread,
Sep 29, 2009, 6:42:20 PM9/29/09
to phr...@googlegroups.com
You can request multiple photos for a single property at once, and you can request multiple photos for multiple properties at once.  All said, it ends up roughly at the same bandwidth consumption but it cuts down on the round-trip requests needed to finish.

I posted a piece of code on the new PHRETS site ( http://troda.com/projects/phrets/index.php?title=Create_batch_list ) but haven't gone back through to show how that can be used.  In short, the main way I use it is to make an array of the listings I need to grab photos for.  So, I end up with an array with a few hundred (or thousand) items, each of which is a single property number.

Normally:

// $list_to_get is the array of single numbers
foreach ($list_to_get as $num) {
     $photos = $rets->GetObject("Property", "Photo", $num);
     foreach ($photos as $photo) {
          // save the photo here
     }
}


Using that function:

// $list_to_get is the array of single numbers
$batches = create_batch_list($list_to_get, 5);
foreach ($batches as $batch) {
     $photos = $rets->GetObject("Property", "Photo", $batch);
     foreach ($photos as $photo) {
          // save the photo here
Reply all
Reply to author
Forward
0 new messages