Setup and usage
The ShrinkTheWeb module allows caching and display of thumbnail images generated by the ShrinkTheWeb service.
On this page:
Installation
Configuration
Usage
Installation
- Register at https://shrinktheweb.com/user/register .
- Upload the module files on your site from http://drupal.org/project/shrinktheweb.
- Enable the ShrinkTheWeb module from admin/modules, section "Other".
Configuration
- Browse to your profile page at https://shrinktheweb.com and get the Access key and Secret keys for your profile.
- Browse to admin/config/media/shrinktheweb.
- Copy the Access key and the Secret key in the text fields.
- Configure the thumbnails folder where the cached images will be stored.
- You could configure the number of days the cached images are kept unchanged.
- You could configure additional ShrinkTheWeb API request parameters such as "Specific page captures", "Custom size captures" and others. Please note that some of the features only become available once you have upgraded to use them and save the settings page.
You could find more information by reading about How to use Website Screenshots.
Usage
Sample usage for Drupal 8:
Using PHP code is not "the Drupal way", so we provide field formatters for intended usage. However, we provide PHP options to extend functionality for those who want it.
theme() function is no longer available in Drupal8. Use drupal_render() by passing a render array with a #theme key in your code instead:
Basic PHP Example (uses global settings)
<?php
$url = 'shrinktheweb.com';
$foo = array(
'#theme' => 'shrinktheweb_image',
'#url' => $url,
);
print drupal_render($foo);
?>
Advanced PHP Example
<?php
$url = 'bing.com';
$foo = array(
'#theme' => 'shrinktheweb_image',
'#url' => $url,
'#custom_width' => 600,
'#full_length' => true,
'#max_height' => 320,
'#native_resolution' => 1020,
'#widescreen_resolution_y' => 760,
'#delay' => 5,
'#quality' => 90
);
print drupal_render($foo);
?>
NOTE: In the basic PHP example or when using field formatters, the requests use the global settings from the ShrinkTheWeb Drupal admin area. Changes to the size, length, or browser resolution (viewport) affect ALL occurrences of screenshots in your Drupal installation. With the advanced PHP example, each individual array can be customized for a specific request that is different from global settings.
Legend of Optional Parameters
- url: enter any URL. If you do not have the "Inside Pages" upgrade, the screenshot will be of the homepage only
- custom_width: enter custom width
- full_length: enter true|false for full-length screenshots
- max_height: height to crop the image
- native_resolution: browser resolution or viewport width
- widescreen_resolution_y: browser resolution or viewport height
- *delay: enter number of seconds to delay, AFTER page load
- *quality: enter quality (1 to 100)
*Available to all accounts for Free
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion