You are here

function shrinktheweb_generateRequestArgs in ShrinkTheWeb 6

Same name and namespace in other branches
  1. 8 shrinktheweb.api.inc \shrinktheweb_generateRequestArgs()
  2. 7 shrinktheweb.api.inc \shrinktheweb_generateRequestArgs()

generate the request arguments

2 calls to shrinktheweb_generateRequestArgs()
shrinktheweb_deleteThumbnail in ./shrinktheweb.api.inc
Delete thumbnail
shrinktheweb_getThumbnail in ./shrinktheweb.api.inc
Gets the thumbnail for the specified website, stores it in the cache, and then returns the relative path to the cached image.

File

./shrinktheweb.api.inc, line 172

Code

function shrinktheweb_generateRequestArgs($aOptions) {
  $aArgs['stwaccesskeyid'] = ACCESS_KEY;
  $aArgs['stwu'] = SECRET_KEY;
  $aArgs['stwver'] = VER;

  // allowing internal links?
  if (INSIDE_PAGES) {
    $aArgs['stwinside'] = 1;
  }

  // If SizeCustom is specified and widescreen capturing is not activated,
  // then use that size rather than the size stored in the settings
  if (!$aOptions['FullSizeCapture'] && !$aOptions['WidescreenY']) {

    // Do we have a custom size?
    if ($aOptions['SizeCustom']) {
      $aArgs['stwxmax'] = $aOptions['SizeCustom'];
    }
    else {
      $aArgs['stwsize'] = $aOptions['Size'];
    }
  }

  // Use fullsize capturing?
  if ($aOptions['FullSizeCapture']) {
    $aArgs['stwfull'] = 1;
    if ($aOptions['SizeCustom']) {
      $aArgs['stwxmax'] = $aOptions['SizeCustom'];
    }
    else {
      $aArgs['stwxmax'] = 120;
    }
    if ($aOptions['MaxHeight']) {
      $aArgs['stwymax'] = $aOptions['MaxHeight'];
    }
  }

  // Change native resolution?
  if ($aOptions['NativeResolution']) {
    $aArgs['stwnrx'] = $aOptions['NativeResolution'];
    if ($aOptions['WidescreenY']) {
      $aArgs['stwnry'] = $aOptions['WidescreenY'];
      if ($aOptions['SizeCustom']) {
        $aArgs['stwxmax'] = $aOptions['SizeCustom'];
      }
      else {
        $aArgs['stwxmax'] = 120;
      }
    }
  }

  // Wait after page load in seconds
  if ($aOptions['Delay']) {
    $aArgs['stwdelay'] = intval($aOptions['Delay']) <= 45 ? intval($aOptions['Delay']) : 45;
  }

  // Use Refresh On-Demand?
  if ($aOptions['RefreshOnDemand']) {
    $aArgs['stwredo'] = 1;
  }

  // Use another image quality in percent
  if ($aOptions['Quality']) {
    $aArgs['stwq'] = intval($aOptions['Quality']);
  }

  // Use custom messages?
  if (CUSTOM_MSG_URL) {
    $aArgs['stwrpath'] = CUSTOM_MSG_URL;
  }
  return $aArgs;
}