scottmac / opengraph

Helper class for accessing the OpenGraph Protocol
462 stars 153 forks source link

Handling Multiple OGP Image tags #7

Open MitchellMcKenna opened 11 years ago

MitchellMcKenna commented 11 years ago

The OGP Arrays section says websites can have multiple images associated with a page and that the "first tag (from top to bottom) is given preference during conflicts".

Currently in the library it looks like if the page has multiple og:image tags, each one will overwrite the previous, so when you call $graph->image you will only get the last og:image value back. Images and any other tags that can have multiple values (eg. videos and audio) should probably return an array.

Argonalyst commented 11 years ago

Well, I'm actually experiencing some problem when I call the $graph->image and the website that I'm parsing dont have the meta property image on it.. so it is resulting in a empty array that is really bugging me out, because it is creating empty img tags (img src="" /) ... The most websites are badly formated for opengraph, its not well disseminated yet or forever, so we should improve the way we handle the results that we get from $graph-> in a better way... I'm working on it