Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback to images in the body if OGP tags are missing #11

Open
MitchellMcKenna opened this issue Mar 18, 2013 · 0 comments
Open

Add fallback to images in the body if OGP tags are missing #11

MitchellMcKenna opened this issue Mar 18, 2013 · 0 comments

Comments

@MitchellMcKenna
Copy link
Contributor

I wanted to get others thoughts on adding a feature where if no OGP tags are present, the library could fallback to images in the HTML.

This should be fairly easily done by selecting all img tags in the body using DOMDocument. An example of using DOMDocument like this is where I do fall back for image_src if an OGP image tag is not provided: 155c2f4

So that tiny images aren't included (such as images unrelated to the specific page, eg. user profile pictures), I suggest the library not return images smaller than say 150x150 px.

Some people may not want this feature to occur however, since unrelated images may be found in the body, so there should be a optional parameter you can pass to fetch() to disable it.

This is also related to issue #7 to update the library to return an array for OGP tag types which allow multiple instances of the tag, such as images/video.

This could likely be done for other tags like video as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant