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: 155c2f4ca8780f90adc5006523b518dae30c5a87
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.
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: 155c2f4ca8780f90adc5006523b518dae30c5a87So 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.