Module Description:
External Link Preview module allows users to preview all the external links that are added into any text area field by fetching their metatags - title, description and image.
How To Use:
In case you have added any external link in any textarea and want to preview the external ink, please follow the following steps :
1. Go to formatter settings of the particluar textarea field under "Manage Display" section of the Entity Type.
2. Select the formatter "Attach Link Preview" from the format select list.
3. Click on the setting of the formatter and choose your desired options.
Project Page:
https://www.drupal.org/sandbox/sanket1007/2704011
Git Repository :
Use this command to clone this project
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/sanket1007/2704011.git extlink_preview
Manual Reviews:
https://www.drupal.org/node/2690703#comment-11089841
https://www.drupal.org/node/2696141#comment-11089937
https://www.drupal.org/node/2667046#comment-11089949

| Comment | File | Size | Author |
|---|---|---|---|
| #15 | drupal7-exernal-links-privew-more-than-one-link.png | 29.08 KB | rajab natshah |
| #10 | extlink_error.png | 50.06 KB | arulraj |
| external_link_preview.png | 273.89 KB | sanket1007 |
Comments
Comment #2
sanket1007 commentedComment #3
sanket1007 commentedComment #4
AshwiniPatil commentedHi Sanket,
Your module is nice.
But giving warning for the link whose html is not been fetched.
You can update with following code on line number 130 in .module file
if (isset($html) && !empty($html)) {
Comment #5
manjit.singhI was trying to add the link in link preview text field :( and forget to add into body field.
Can you please add the usage of this module in readme file so that it would be easy for others to figure out.
Comment #6
madan879 commentedHi sanket1007,
I have checked your module as manual review. Below warning message I am getting after installed your module.
Warning: DOMDocument::loadHTML(): Empty string supplied as input in extlink_preview_get_og_metatags() (line 317 of D:\xampp\htdocs\drupal-7.43\sites\all\modules\contrib\extlink_preview\extlink_preview.module).
And I am not getting link preview as you attached image. Its redirect to external link only.. So Please kindly guide me any more configuration setting is required..
Comment #7
sanket1007 commentedThanks AshwiniPatil, Manjit.Singh and madan879 for reviewing the module.
@AshwinPatil : I have updated the code now. Thanks for pointing out the mistake.
@manjit.Singh : I have added some more help text to let user understand on how to use it.
@madan879 : Please let me know the steps that you followed. Also refer the README file for help.
Comment #8
sanket1007 commentedComment #9
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #10
arulraj commentedTrying to enable External Link Preview module getting syntax error in extlink_preview.module at line 114. Please refer the attached image.
Comment #11
arulraj commentedComment #12
SGhosh commentedAwesome module! :)
Works really great and such a relevant and highly used functionality in so many sites - FB, LinkedIn. It is a surprise that such a module didn't already exist. So thank you for working on it and brining it to the community.
I went through your code and have a few feedback -
* We can have another option while configuring the formatter settings whether to show the link in the textarea as well or not. Right now it's showing by default.
* Along with that, optionally, the preview could also be linked.
* It would be good to add comments in your code so anybody can understand how its working - which means how the module is working in code.
* At line 125, there is no need to check for $link as we are already doing it on line 124
* For an a tag with href inside single quotes, the link that is being used to fetch the page info is getting incorrectly formed. You could instead you preg_split for multiple delimiters - preg_split( "/(\"|')/", $link);
* Why was it necessary to declare a user agent for fetching the page via curl?
* You could also use php html parser functions instead of preg_match. Test out the performances of both to find out which is better.
My initial feedback. Going through the code so will come back with more feedback :)
Comment #13
sanket1007 commented@somedutta - Thanks Someduttta for taking your time out for review and mentioning some awesome points that I could not think of.
I have implemented the code changes that u suggested and is up for review again.
And user agent is required as some links do not allow us to fetch their data and results in an empty set.
Also I am figuring out on other configurations which can enhance the module functionality.
Thanks a ton.
@arul_raj - I think this problem came specifically to you. Me and any other user could not replicate the same issue. Although i have made some changes and hence request you to please download it and try again. Please let me know of you find any issues.
Comment #14
sanket1007 commentedComment #15
rajab natshahHi Sanket,
A great Idea for a needed module.
Manual Review:
1. For the scenario of other supported Field types, I think we should include "links", "external links" for better use.
2. For the scenario of some urls will not have an image or a default image for the OG or twitter cards. and that brings some errors or working
Warning: getimagesizeSome validation in php will take errors or warnings out.
I think that if we could have the option to select Image style will fix many issues.
3. For the scenario of adding more than one link in the page. We do not know the expected link which will be reviewed as you can see from the following screenshot.

4. Caching curl calles will save a lot, I do think drupal_http_request is much better to use. and you can have timeout, then first try, second try, third try. It's better to have fallback options.
Rewarded :)
Comment #16
EversonDaSilva commentedGreat module and very useful! Here's my manual review:
1. I would recommend to wrap your css with a class with the name of your module to avoid conflict.
2. When I changed the format of the field, the url no longer turned into a link, even though we can access the page through the preview
3. Sometimes, the preview informed a "page not found" error and when I checked the link, I saw some html tags such as
.
4. For future work, I would recommend to add an option in the settings to see the preview only when hover the link.
Great work! Thanks for sharing this module with us!
Comment #17
klausiEverson: I think you forgot to change the @status. Is this now RTBC after your review or are there application blockers left?
Comment #18
gaurav.goyal commentedHi @sanket
Good module, and it will be very useful. I went through your module and it works for me. Also, I agree with the points of @EversonDaSilva but I think none of them looks like application blocker to me.
Hi @klausi
Changing the status to RBTC and we can promote this module as a full project.
Thanks @Sanket for wonderful work on this.
Comment #19
ugintl commentedhow is it different from opengraph filter module?
Comment #20
sanket1007 commentedOpen graph filter module only extracts og tags from the links. There are many webpages where we do not have og tags and hence no information is extracted from those links.
This module works exactly similar to facebook or linkedin, where we not only extracts open graph tags but also extracts other metatags like twitter tags or meta descriptions. Also if there is no image defined in og or twitter tags, it extracts the best possible image from the site. So in a way its a complete solution as it works for all kinds of webpages or weblinks.
Comment #21
mlncn commentedThanks for your contribution! Congratulations, you are now a vetted Git user. You can promote this to a full project.
When you create new projects (typically as a sandbox to start) you can then promote them to a full project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.