OpenRealEstate / OpenRealEstate.NET

OBSOLETE REPO - PLEASE DO NOT USE. Use https://github.com/OpenRealEstate instead
MIT License
10 stars 10 forks source link

Adds support for Category node #2

Closed ctolkien closed 9 years ago

PureKrome commented 9 years ago

@ctolkien can you please post a snippet of the xml (from the rea xml source) which this PR is addressing, please?

ctolkien commented 9 years ago

https://github.com/OpenRealEstate/OpenRealEstate.NET/blob/master/Code/OpenRealEstate.Tests/Sample%20Data/Transmorgrifiers/REA/REA-AllTypes.xml#L35

And re: image forma ('format' attribute)t:

https://github.com/OpenRealEstate/OpenRealEstate.NET/blob/master/Code/OpenRealEstate.Tests/Sample%20Data/Transmorgrifiers/REA/REA-AllTypes.xml#L85

Let me know if this was addressed elsewhere in the API (I couldn't spot it).

PureKrome commented 9 years ago

AH!

re: <img ... format="jpg" /> I'm not putting that in, on purpose. Like seriously .. why the fuck do we care about the format?

re: <category name="House" /> How the hell did that get missed?

/me double checks that I haven't done that elsewhere.

ctolkien commented 9 years ago

I'm not putting that in, on purpose. Like seriously .. why the fuck do we care about the format?

We have to scrap these from a remote server in the URL provided - I don't trust the mime type provided by the 3rd party and there is no file extension to go by... Need someway of knowing what type of image it is (preferably w/o cracking the file open).

PureKrome commented 9 years ago

but why? it's an image. who cares? most people (from the data i've seen) it's all jpg .. it's like they don't care and just keep it with that value.

downloading the urls and then storing them in S3 amazon / Azure blob / etc ... is totally np with/without the extension type.

ctolkien commented 9 years ago

but why? it's an image. who cares?

Browsers :) I don't want to send a PNG image down with a image/jpeg mime type (for instance) telling the browser to decode the image as a PNG when it's not. It will still probably work - browsers are very resilient at handling incorrect things, but it may generate a warning and is not ideal.

PureKrome commented 9 years ago

How is your browser sending an image down with a jpeg mine type, when the image is actually an PNG?

<img src="http://your.website.com/images/rental1.jpg" alt="pew pew"/>

??

ctolkien commented 9 years ago

Here's the issue, I'm scraping the images from a 3rd party the XML comes in as:

<img id="m" modTime="2009-01-01-12:30:00" url="http://www.3rdparty.com/abcdefg" format="jpg" />

Without the "format" attribute (and remembering I don't trust the mime type provided by the 3rd party), how am I to determine if it's a jpg or png (or gif, or whatever)?

PureKrome commented 9 years ago

how am I to determine if it's a jpg or png (or gif, or whatever)

you don't :) the browser just displays the image. Magic!

ctolkien commented 9 years ago

Magic!

Not magic! It already knows it's a GIF, it's in the response headers:

Content-Type:image/gif

As I said, browsers will generally deal, but it's relying on hacky behaviour (and they may not get the full features, for instance, progressive jpegs may not load progressively if not served with the correct mime type).

PureKrome commented 9 years ago

RE: Category type. Already done.

ctolkien commented 9 years ago

Closing this one PK! but still want my content type support at some stage for images :dancer: