Voting starts in March for the Drupal Association Board election.
- Register at http://www.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".
- Browse to your profile page at http://www.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.
Using Field Formatters
Starting with version 7.x-1.2, there is field formatter support for the Link module. You'll find the new formatters listed as format options on the 'Manage display' tab for all of your link fields when both modules are installed. For more details, read about content types and fields and how fields are displayed.
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, ); echo 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 ); echo 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
Sample usage for Drupal 7:
Use a field formatter or call the URL preview theme functions directly.
7.x-1.1 and earlier:
<?php $url = 'http://shrinktheweb.com'; echo theme_shrinktheweb_image($url); ?>
NOTE: It is now considered "bad practice" to use the theme() function in Drupal 7 also. Please consider using the instructions for Drupal 8 above.
7.x-1.2 and later:
<?php $url = 'http://shrinktheweb.com'; theme('shrinktheweb_image', array('url' => $url)); ?>
Sample usage for Drupal 6:
The ShrinkTheWeb module's functionality should be used in custom php files such as modules or theme related functionality. This functionality could be included in Drupal block definitions or Drupal custom pages when the format of the content is set to PHP.
<?php $url = 'http://shrinktheweb.com'; echo theme("shrinktheweb_image", $url); ?>
Please note that in most cases, the thumbnail image won't be immediately available, especially an image which is generated from an internal page. In this case, no image is displayed unless the function "theme_shrinktheweb_image" is predefined by the themer/developer. The image will be displayed once it was generated by the ShrinkTheWeb service, successfully retrieved and cached locally.