screenshot_one
No security coverage
Screenshot one is a module that currently have two things available for it. The one thing is a service where you can generate screenshots from the Screenshot One service for any third party module that would want to use it.
The other core feature is that it has two AI Automator types for the AI Automator module that can be found in the AI module. These makes it possible to take a link field and either automate it into an Image field or a Media Image field.
Note that this is the follow up module of the AI Interpolator Screenshot and makes that module obsolete.
Features
- It can remove cookie banners automatically on the webpage you want to screenshot.
- It can screenshot the full web page, not just over the fold.
- (or) you can screenshot the exact dimensions you set.
Requirements
- Requires an account at Screenshot One. You can test 100 screenshots for free.
- To use it, you need to use a third party module using the service. Currently its only usable with the AI Automator submodule of the AI module
How to setup with AI Automator
- Install the AI module.
- Install this module.
- Visit /admin/config/screenshot-one/settings and add your api and secret keys from your Screenshot One account.
- Create some entity or node type with a link field.
- Create either an Image or Media field on the same entity.
- Enable AI Automator checkbox and configure it.
- Create an entity of the type you generated, fill in some link and save.
- The screenshot will be filled out.
Use the service
If you are a third party module that wants to use this service, you can take this example code for screenshotting Googles firstpage.
$screenshot_one = \Drupal::service('screenshot_one.api');
// Configure how you want it to run.
$screenshot_config = [
'full_page' => TRUE, // If it should do a full page screenshot. Othewise width and height parameters.
'delay' => 1, // Wait 1 second before taking the screenshot.
'format' => 'jpg', // Get it as jpg.
'image_quality' => 90, // 90% image quality.
'selector' => '#content', // Only get the content id and what is in it.
];
// Take the screenshot.
$binary = $screenshot_one->screenshotUrl('https://www.google.com', $config);
...code to create image or whatever from binary.