What a stunning module, thank you Frans! I was just wondering, how would we scrape an image from the remote site as well please?

Looking most forward to the development of your module. Already see so many uses, ie as an entity field with flags, comments etc :)

Comments

frans’s picture

Tnx Lilian!

Thumbnails are now showing, once the URL uses og:image. Example, use http://www.imdb.com/title/tt0117500/ in your text. More and more sites are using this, just because of our mutual friend Mark Zuckerberg.

But that didn't answer your question...
We can scrape images in the body with a submodule.

Use a HOOK_preprocces_opengraph_filter just like
template_preprocess_opengraph_filter
http://drupalcode.org/project/opengraph_filter.git/blob/refs/heads/7.x-1...

In that preprocess do something like this

$html = opengraph_filter_get_html($variables['uri']);
$variables['even_more_images'] = your_own_function_that_parses_html($html);

Then write the needed function.

function your_own_function_that_parses_html($html) {
// inspiration can be found here
// http://drupalcode.org/project/opengraph_filter.git/blob/refs/heads/7.x-1.x:/opengraph_filter.module#l35
}

The function opengraph_filter_get_html caches the output on the first call, so it should not add extra overhead, other then the magic you add for extracting img tags.

Issues to solve:

  • What makes an image usable as thumbnail? (dimensions? >80px? <400px?)
  • The only way to know dimensions is by downloading the image (overhead, speed after submit)
  • What about HTTPS content with HTTP external images; browser warnings! (issue is now in the module)

Best would be if we find a way to download the image to the local disk, so that we can do imagecache on the module. I know... this is Drupal, so 'There Is A Module For That'™
In this case I know 2 we can use:
http://drupal.org/project/imagecache_external
// Something for the theme function opengraph_filter_image?
http://drupal.org/project/image_resize_filter
// Can be used now i guess, just add the filter after opengraph_filter

My only concern is the speed of it all. Once you hit save on your comment, it starts looking for urls, then from that url it scrapes images, it download images and resizes them... hmmmmm Can't we come up with something better?

3dnathaniel’s picture

Issue summary: View changes

Any luck on this?

Having real issues when the site isn't using og:image or other og tags.

loon’s picture

Status: Active » Postponed
loon’s picture

Status: Postponed » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.