function shrinktheweb_getThumbnail in ShrinkTheWeb 7
Same name and namespace in other branches
- 8 shrinktheweb.api.inc \shrinktheweb_getThumbnail()
- 6 shrinktheweb.api.inc \shrinktheweb_getThumbnail()
Gets the thumbnail for the specified website, stores it in the cache, and then returns the relative path to the cached image.
1 call to shrinktheweb_getThumbnail()
File
- ./
shrinktheweb.api.inc, line 127
Code
function shrinktheweb_getThumbnail($sUrl, $aOptions) {
// create cache directory if it doesn't exist
shrinktheweb_createCacheDirectory();
$aArgs = shrinktheweb_generateRequestArgs($aOptions);
// Try to grab the thumbnail
$iCacheDays = CACHE_DAYS + 0;
if ($iCacheDays >= 0 && $aOptions['Embedded'] != 1) {
$aArgs['stwurl'] = $sUrl;
$sImageUrl = shrinktheweb_getCachedThumbnail($aArgs);
}
else {
// Get raw image data
unset($aArgs['stwu']);
// ONLY on "Advanced" method requests!! (not allowed on embedded)
$aArgs['stwembed'] = 1;
$aArgs['stwurl'] = $sUrl;
$sImageUrl = urldecode(PROTOCOL . 'images.shrinktheweb.com/xino.php?' . http_build_query($aArgs, '', '&'));
}
return $sImageUrl;
}