open graph support for shaarli (cleaning)

This commit is contained in:
n 2017-02-11 23:29:37 +01:00
parent 95df8e3c86
commit f3f70d2238

View file

@ -1,6 +1,6 @@
--- Shaarli/index.php 2017-01-20 16:47:36.000000000 +0100 --- Shaarli/index.php 2017-01-20 16:47:36.000000000 +0100
+++ index.php 2017-02-11 18:29:08.779509000 +0100 +++ /home/www/beta/Shaarli/index.php 2017-02-11 23:27:22.510042000 +0100
@@ -1821,11 +1821,16 @@ @@ -1821,11 +1821,14 @@
$path = parse_url($url,PHP_URL_PATH); $path = parse_url($url,PHP_URL_PATH);
if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL. if ("/talks/" !== substr($path,0,7)) return array(); // This is not a single video URL.
} }
@ -9,8 +9,6 @@
- return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url), - return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url),
+ $thumbname=hash('sha1',$url).'.gif'; + $thumbname=hash('sha1',$url).'.gif';
+ $filepath = $conf->get('resource.thumbnails_cache').'/'.$thumbname; + $filepath = $conf->get('resource.thumbnails_cache').'/'.$thumbname;
+ //echo sha1_file($filepath);
+ //echo $filepath;
+ if (sha1_file($filepath) != '48d45d7ada69f9f858849bbd6e459f66c9694ee7') + if (sha1_file($filepath) != '48d45d7ada69f9f858849bbd6e459f66c9694ee7')
+ return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url), + return array('src'=>index_url($_SERVER).'?do=genthumbnail&hmac='.$sign.'&url='.urlencode($url),
'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail'); 'href'=>$href,'width'=>'120','style'=>'height:auto;','alt'=>'thumbnail');
@ -20,7 +18,7 @@
// For all other, we try to make a thumbnail of links ending with .jpg/jpeg/png/gif // For all other, we try to make a thumbnail of links ending with .jpg/jpeg/png/gif
// Technically speaking, we should download ALL links and check their Content-Type to see if they are images. // Technically speaking, we should download ALL links and check their Content-Type to see if they are images.
// But using the extension will do. // But using the extension will do.
@@ -2154,19 +2159,33 @@ @@ -2154,19 +2157,33 @@
else else
{ {
// For all other domains, we try to download the image and make a thumbnail. // For all other domains, we try to download the image and make a thumbnail.