vendor/knplabs/knp-snappy/src/Knp/Snappy/Image.php line 16

Open in your IDE?
  1. <?php
  2. namespace Knp\Snappy;
  3. /**
  4.  * Use this class to create a snapshot / thumbnail from a HTML page.
  5.  *
  6.  * @author  Matthieu Bontemps <matthieu.bontemps@knplabs.com>
  7.  * @author  Antoine Hérault <antoine.herault@knplabs.com>
  8.  */
  9. class Image extends AbstractGenerator
  10. {
  11.     /**
  12.      * {@inheritdoc}
  13.      */
  14.     public function __construct($binary null, array $options = [], array $env null)
  15.     {
  16.         $this->setDefaultExtension('jpg');
  17.         parent::__construct($binary$options$env);
  18.     }
  19.     /**
  20.      * {@inheritdoc}
  21.      */
  22.     protected function configure()
  23.     {
  24.         $this->addOptions([
  25.             'allow' => null,                            // Allow the file or files from the specified folder to be loaded (repeatable)
  26.             'bypass-proxy-for' => null,                 // Bypass proxy for host (repeatable)
  27.             'cache-dir' => null,                        // Web cache directory
  28.             'checkbox-checked-svg' => null,             // Use this SVG file when rendering checked checkboxes
  29.             'checked-svg' => null,                      // Use this SVG file when rendering unchecked checkboxes
  30.             'cookie' => [],                             // Set an additional cookie (repeatable)
  31.             'cookie-jar' => null,                       // Read and write cookies from and to the supplied cookie jar file
  32.             'crop-h' => null,                           // Set height for cropping
  33.             'crop-w' => null,                           // Set width for cropping
  34.             'crop-x' => null,                           // Set x coordinate for cropping (default 0)
  35.             'crop-y' => null,                           // Set y coordinate for cropping (default 0)
  36.             'custom-header' => [],                      // Set an additional HTTP header (repeatable)
  37.             'custom-header-propagation' => null,        // Add HTTP headers specified by --custom-header for each resource request.
  38.             'no-custom-header-propagation' => null,     // Do not add HTTP headers specified by --custom-header for each resource request.
  39.             'debug-javascript' => null,                 // Show javascript debugging output
  40.             'no-debug-javascript' => null,              // Do not show javascript debugging output (default)
  41.             'encoding' => null,                         // Set the default text encoding, for input
  42.             'format' => $this->getDefaultExtension(),   // Output format
  43.             'height' => null,                           // Set screen height (default is calculated from page content) (default 0)
  44.             'images' => null,                           // Do load or print images (default)
  45.             'no-images' => null,                        // Do not load or print images
  46.             'disable-javascript' => null,               // Do not allow web pages to run javascript
  47.             'enable-javascript' => null,                // Do allow web pages to run javascript (default)
  48.             'javascript-delay' => null,                 // Wait some milliseconds for javascript finish (default 200)
  49.             'load-error-handling' => null,              // Specify how to handle pages that fail to load: abort, ignore or skip (default abort)
  50.             'load-media-error-handling' => null,        // Specify how to handle media files that fail to load: abort, ignore or skip (default ignore)
  51.             'disable-local-file-access' => null,        // Do not allowed conversion of a local file to read in other local files, unless explicitly allowed with allow
  52.             'enable-local-file-access' => null,         // Allowed conversion of a local file to read in other local files. (default)
  53.             'minimum-font-size' => null,                // Minimum font size
  54.             'password' => null,                         // HTTP Authentication password
  55.             'disable-plugins' => null,                  // Disable installed plugins (default)
  56.             'enable-plugins' => null,                   // Enable installed plugins (plugins will likely not work)
  57.             'post' => [],                               // Add an additional post field
  58.             'post-file' => [],                          // Post an additional file
  59.             'proxy' => null,                            // Use a proxy
  60.             'quality' => null,                          // Output image quality (between 0 and 100) (default 94)
  61.             'quiet' => null,                            // Be less verbose
  62.             'radiobutton-checked-svg' => null,          // Use this SVG file when rendering checked radio-buttons
  63.             'radiobutton-svg' => null,                  // Use this SVG file when rendering unchecked radio-buttons
  64.             'run-script' => null,                       // Run this additional javascript after the page is done loading (repeatable)
  65.             'disable-smart-width' => null,              // Use the specified width even if it is not large enough for the content
  66.             'enable-smart-width' => null,               // Extend --width to fit unbreakable content (default)
  67.             'stop-slow-scripts' => null,                // Stop slow running javascript
  68.             'no-stop-slow-scripts' => null,             // Do not stop slow running javascript (default)
  69.             'transparent' => null,                      // Make the background transparent in pngs *
  70.             'use-xserver' => null,                      // Use the X server (some plugins and other stuff might not work without X11)
  71.             'user-style-sheet' => null,                 // Specify a user style sheet, to load with every page
  72.             'username' => null,                         // HTTP Authentication username
  73.             'width' => null,                            // Set screen width (default is 1024)
  74.             'window-status' => null,                    // Wait until window.status is equal to this string before rendering page
  75.             'zoom' => null,                             // Use this zoom factor (default 1)
  76.         ]);
  77.     }
  78. }