Real Estate Forums

Coding HTML, ASP, PHP, JAVA MYSQL and more. All coding questions should be asked here.

Reply
 
Thread Tools Display Modes
Old 09-21-2005, 11:30 AM
Alteczen Alteczen is offline
Real Estate Nu-bee
 
Join Date: Sep 2005
Posts: 1
Alteczen is on a distinguished road
Default Binary Images are going to kill me

I'm running PHP 5.0.4 on Windows Server 2003.

I'm currently working on a real estate website that dynamically pulls information from a RETS server. This server holds data about homes for sale on the MLS. Here is the problem:

I'm trying to pull the images of a house from the server. I get all of the header information and then the binary data stream (I think it's bindary) as seen below. I am trying to display this image:





[code]HTTP/1.1 200 OK
Date: Wed, 21 Sep 2005 01:05:24 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET (03)
X-AspNet-Version: 1.1.4322
MIME-Version: 1.0
Object-ID: 1
Content-Description:
Content-Length: 28211
RETS-Version: RETS/1.5
Cache-Control: private
Content-Type: image/jpeg

Code:
JFIFKKC  

 $.' ",#(7),01444'9=82<.342C     

2!!22222222222222222222222222222222222222222222222222," 
ĵ}!1AQa"q2#BR$3br 
%&'()*456789& #58;CDEFGHIJSTUVWXYZcdefghijstuvwxyz
 
ĵw!1AQaq"2B #3Rbr
$4%&'()*56789& #58;CDEFGHIJSTUVWXYZcdefghijstuvwxyz
 ?"p@:JHG*Q /)CA
J((]"~B]"F))n>|7EE.(&?N})1K>/(I?Fh)>  ϰ?!E~B4qA
Ky..%Hany=q^<e&{5ڄ&j>(ҽwWb3տ⸍_WP 
M;(~Mh껕pfQ(노5f%%G&=+H-<I *mIGFoc4;L ?n ;c>pWA۸A@<Gkڋ=PD8ogEj`}(}!\uqik>Kz^*zi= NA
7A
J)  6PA
7A
m~B~B>d~BE.  (plus many more characters...)
We have a PHP function that strips off the header information from the RETS server (that you now see above) so that all that remains is the binary data stream. Also, I am setting the headers on this particular page to content-type = image\jpeg and content-length = strlen(binarystream). I then reference this PHP page from the page that I am wanting to display the image on by <img src="displayimage.php">. From everything Ive seen, this should work however, all we get is a broken image link. Is there anything we should be or should not be doing to the binary data stream in order to display this data as an image?

Thanks for the help...
Reply With Quote
Old 09-22-2005, 12:53 PM
Aaron Aaron is offline
Real Estate Webmasters Staff
 
Join Date: Jun 2005
Location: Nanaimo
Posts: 6,712
Aaron is on a distinguished road
Send a message via MSN to Aaron
Default Re: Binary Images are going to kill me

Hi ... Is getting the binary data for the is the only option? I have set up a connection with a RETS server, and I was able to just download the full image file, but anyways... Maybe something like this will help you ...

file1.php
Code:
<html>

<body>

<img src="1b.php">

</body>

</html>
file2.php
Code:
<?php

    header("Content-type: img/jpeg");

    $filename = "filename.jpg";

    $fp = fopen($filename,  "rb");

    $image = fread($fp, filesize($filename));

    fclose($fp);

    echo $image;

?>
Reply With Quote
Old 05-26-2006, 08:24 AM
loki_racer loki_racer is offline
Advancing Webmaster
 
Join Date: May 2006
Posts: 34
loki_racer is on a distinguished road
Default Re: Binary Images are going to kill me

Did you ever get this figured out?

I am running into the same problems.
Reply With Quote
Old 05-27-2006, 05:24 PM
Aaron Aaron is offline
Real Estate Webmasters Staff
 
Join Date: Jun 2005
Location: Nanaimo
Posts: 6,712
Aaron is on a distinguished road
Send a message via MSN to Aaron
Default Re: Binary Images are going to kill me

Not really, seems to be very difficult to pull images from a RETS server.
I continue to run into this problem also.
Reply With Quote
Old 05-27-2006, 06:09 PM
loki_racer loki_racer is offline
Advancing Webmaster
 
Join Date: May 2006
Posts: 34
loki_racer is on a distinguished road
Default Re: Binary Images are going to kill me

I don't have a problem getting the images, but they come down encoded, but I can't figure out how they are encoded.

I am using PHP and have tried decoding them using every method I can think of.

Are you even able to pull the binary? If not I can give you my PHP code that does it.
Reply With Quote
Old 06-14-2006, 11:43 AM
RobertD RobertD is offline
Advancing Webmaster
 
Join Date: Sep 2005
Posts: 63
RobertD is on a distinguished road
Default Re: Binary Images are going to kill me

All images are binary. You have to write them as binary objects not as text objects.

Also, 99.9% of MLS's do not allow you to dynamically pull images for each display liek that. You have to download them locally once and use them from your local system.
Reply With Quote
Old 06-14-2006, 11:46 PM
langard langard is offline
Real Estate WebMaster
 
Join Date: Apr 2006
Posts: 208
langard is on a distinguished road
Default Re: Binary Images are going to kill me

Like RobertD said, all images are binary. Looks like the code example you've posted is in ASCII. I don't know if your MLS is storing the pics in their database in BLOB (Binary Large Object) fields - instead of in a simple folder as complete MIME files, which is a lot faster - but it's a bad idea if they are because you have to reconstruct them pixel-by-pixel...and then store them. At any rate, you're getting the wrong data type.
__________________
LanGard MicroDevelopers Oregon Real Estate Agent and Company Directory
Reply With Quote
Old 06-15-2006, 12:32 AM
RobertD RobertD is offline
Advancing Webmaster
 
Join Date: Sep 2005
Posts: 63
RobertD is on a distinguished road
Default Re: Binary Images are going to kill me

No, it's not the way the MLS is storing them or sending them. It's 100% the way that they are writing them. The photos are sent as binary streams, and you have to write the photos as binary objects.
Reply With Quote
Old 06-15-2006, 12:53 AM
langard langard is offline
Real Estate WebMaster
 
Join Date: Apr 2006
Posts: 208
langard is on a distinguished road
Default Re: Binary Images are going to kill me

In that case you can do it out of the PHP Manual.
__________________
LanGard MicroDevelopers Oregon Real Estate Agent and Company Directory
Reply With Quote
Old 06-15-2006, 05:58 AM
loki_racer loki_racer is offline
Advancing Webmaster
 
Join Date: May 2006
Posts: 34
loki_racer is on a distinguished road
Default Re: Binary Images are going to kill me

I have tried everything I could think of to get the binary stream to form into a picture using the GD library. I was unable to figure it out.

Instead, I just use the fget and similiar commands to pull the image straight from their server and store it locally.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

For our members

Main Sections

IDX Coverage Areas

Spiders Welcome

All times are GMT -7. The time now is 12:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.