You are here

function shrinktheweb_getNoResponseImage in ShrinkTheWeb 6

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

Gets the account problem image and returns the relative path to the cached image

1 call to shrinktheweb_getNoResponseImage()
shrinktheweb_getThumbnailAdvanced in ./shrinktheweb.api.inc

File

./shrinktheweb.api.inc, line 391

Code

function shrinktheweb_getNoResponseImage($sUrl, $aOptions) {

  // create cache directory if it doesn't exist
  shrinktheweb_createCacheDirectory();
  $aOptions = shrinktheweb_generateOptions($aOptions);
  $aArgs['stwaccesskeyid'] = 'accountproblem';
  if ($aOptions['SizeCustom']) {
    $aArgs['stwxmax'] = $aOptions['SizeCustom'];
  }
  else {
    $aArgs['stwsize'] = $aOptions['Size'];
  }
  $sRequestUrl = 'http://images.shrinktheweb.com/xino.php';
  $sRemoteData = shrinktheweb_fileGetContent($sRequestUrl, $aArgs);
  if ($sRemoteData != '') {
    $aResponse = shrinktheweb_getXMLResponse($sRemoteData);
    if (!$aResponse['exists'] && $aResponse['thumbnail'] != '') {
      $sImageUrl = $aResponse['thumbnail'];
      $sFilename = NO_RESPONSE_IMAGE;
      $sFile = THUMBNAIL_DIR . $sFilename;
      $isDownloaded = shrinktheweb_downloadRemoteImageToLocalPath($sImageUrl, $sFile);
      if ($isDownloaded == true) {
        return THUMBNAIL_URI . $sFilename;
      }
    }
  }
  return false;
}