diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-25 20:48:42 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-25 20:48:42 -0300 |
commit | 153bf795eb756fdd92583ccd4d2485640085015d (patch) | |
tree | ccbc2ade152fe35cb65cb3582b6ebfc17f1166bf | |
parent | e5ebe4e5519c48b225b03b5532eb8c5643b7afea (diff) | |
download | semanticscuttle-153bf795eb756fdd92583ccd4d2485640085015d.tar.gz semanticscuttle-153bf795eb756fdd92583ccd4d2485640085015d.tar.bz2 |
Cache: PNG support
-rw-r--r-- | data/templates/default/bookmarks.tpl.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php index 19ab6a8..4f22e91 100644 --- a/data/templates/default/bookmarks.tpl.php +++ b/data/templates/default/bookmarks.tpl.php @@ -345,6 +345,7 @@ if ($currenttag!= '') { $assetHash = substr($assetHash, 0, 2) . '/' . substr($assetHash, 2, 2) . '/' . $assetHash; $assetLink = $GLOBALS['cacheUrl'] . '/' . $assetHash; $assetPdf = $assetLink .'/screenshot.pdf'; + $assetPng = $assetLink .'/screenshot.png'; // Check if the link exists if ($fp = curl_init($assetLink)) { @@ -369,6 +370,20 @@ if ($currenttag!= '') { curl_close($fp); } + + // Check if PNG is available + if ($fp = curl_init($assetPng)) { + curl_setopt($fp, CURLOPT_NOBODY, true); + curl_exec($fp); + + $retcode = curl_getinfo($fp, CURLINFO_HTTP_CODE); + + if ($retcode != 404) { + $cacheLink .= " | <a href=\"$assetPng\">PNG</a>"; + } + + curl_close($fp); + } } curl_close($fp); |