Update thumbnail integration after rebasing the branch

This commit is contained in:
ArthurHoaro 2017-11-11 14:01:21 +01:00
parent a3724717ec
commit e85b7a05a1
21 changed files with 453 additions and 210 deletions

View file

@ -1,6 +1,11 @@
<?php
namespace Shaarli;
use Shaarli\Config\ConfigManager;
use WebThumbnailer\Exception\WebThumbnailerException;
use WebThumbnailer\WebThumbnailer;
use WebThumbnailer\Application\ConfigManager as WTConfigManager;
/**
* Class Thumbnailer
@ -28,7 +33,7 @@ class Thumbnailer
{
$this->conf = $conf;
$this->wt = new WebThumbnailer();
\WebThumbnailer\Application\ConfigManager::addFile('inc/web-thumbnailer.json');
WTConfigManager::addFile('inc/web-thumbnailer.json');
$this->wt->maxWidth($this->conf->get('thumbnails.width'))
->maxHeight($this->conf->get('thumbnails.height'))
->crop(true)
@ -44,6 +49,12 @@ class Thumbnailer
*/
public function get($url)
{
return $this->wt->thumbnail($url);
try {
return $this->wt->thumbnail($url);
} catch (WebThumbnailerException $e) {
// Exceptions are only thrown in debug mode.
error_log(get_class($e) .': '. $e->getMessage());
return false;
}
}
}

View file

@ -480,7 +480,19 @@ class Updater
}
$this->conf->write($this->isLoggedIn);
return true;
}
/**
* * Move thumbnails management to WebThumbnailer, coming with new settings.
*/
public function updateMethodWebThumbnailer()
{
$this->conf->set('thumbnails.enabled', $this->conf->get('thumbnail.enable_thumbnails', true));
$this->conf->set('thumbnails.width', 125);
$this->conf->set('thumbnails.height', 90);
$this->conf->remove('thumbnail');
$this->conf->write(true);
return true;
}
}

View file

@ -1,10 +0,0 @@
import Blazy from 'blazy';
(() => {
const picwall = document.getElementById('picwall_container');
if (picwall != null) {
// Suppress ESLint error because that's how bLazy works
/* eslint-disable no-new */
new Blazy();
}
})();

View file

@ -0,0 +1,7 @@
import Blazy from 'blazy';
(() => {
// Suppress ESLint error because that's how bLazy works
/* eslint-disable no-new */
new Blazy();
})();

View file

@ -146,6 +146,10 @@ body,
background-color: $main-green;
}
.page-single-alert {
margin-top: 100px;
}
.anchor {
&:target {
padding-top: 40px;

View file

@ -19,7 +19,7 @@
"shaarli/netscape-bookmark-parser": "^2.0",
"erusev/parsedown": "^1.6",
"slim/slim": "^3.0",
"arthurhoaro/web-thumbnailer": "dev-master",
"arthurhoaro/web-thumbnailer": "^1.0",
"pubsubhubbub/publisher": "dev-master",
"gettext/gettext": "^4.4"
},

43
composer.lock generated
View file

@ -4,8 +4,49 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "308a35eab91602fbb449f2c669c445ed",
"content-hash": "efa8b74ec9a15bb8c18e4a36fd13d480",
"packages": [
{
"name": "arthurhoaro/web-thumbnailer",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/ArthurHoaro/web-thumbnailer.git",
"reference": "10e2919c2aa0bf55f4593c8b05508a98c79d6706"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ArthurHoaro/web-thumbnailer/zipball/10e2919c2aa0bf55f4593c8b05508a98c79d6706",
"reference": "10e2919c2aa0bf55f4593c8b05508a98c79d6706",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "5.2.*"
},
"type": "library",
"autoload": {
"psr-0": {
"WebThumbnailer\\": [
"src/",
"tests/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Arthur Hoaro",
"homepage": "http://hoa.ro"
}
],
"time": "2017-11-11T15:39:49+00:00"
},
{
"name": "container-interop/container-interop",
"version": "1.2.0",

View file

@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Shaarli\n"
"POT-Creation-Date: 2018-01-24 18:43+0100\n"
"PO-Revision-Date: 2018-03-06 18:44+0100\n"
"POT-Creation-Date: 2018-05-05 12:47+0200\n"
"PO-Revision-Date: 2018-05-05 12:47+0200\n"
"Last-Translator: \n"
"Language-Team: Shaarli\n"
"Language: fr_FR\n"
@ -56,7 +56,7 @@ msgstr "Liens directs"
#: application/FeedBuilder.php:153
#: tmp/daily.b91ef64efc3688266305ea9b42e5017e.rtpl.php:88
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:178
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:177
msgid "Permalink"
msgstr "Permalien"
@ -68,18 +68,22 @@ msgstr "Le fichier d'historique n'est pas accessible en lecture ou en écriture"
msgid "Could not parse history file"
msgstr "Format incorrect pour le fichier d'historique"
#: application/Languages.php:161
#: application/Languages.php:177
msgid "Automatic"
msgstr "Automatique"
#: application/Languages.php:162
#: application/Languages.php:178
msgid "English"
msgstr "Anglais"
#: application/Languages.php:163
#: application/Languages.php:179
msgid "French"
msgstr "Français"
#: application/Languages.php:180
msgid "German"
msgstr "Allemand"
#: application/LinkDB.php:136
msgid "You are not authorized to add a link."
msgstr "Vous n'êtes pas autorisé à ajouter un lien."
@ -163,11 +167,11 @@ msgstr ""
"a été importé avec succès en %d secondes : %d liens importés, %d liens "
"écrasés, %d liens ignorés."
#: application/PageBuilder.php:168
#: application/PageBuilder.php:173
msgid "The page you are trying to reach does not exist or has been deleted."
msgstr "La page que vous essayez de consulter n'existe pas ou a été supprimée."
#: application/PageBuilder.php:170
#: application/PageBuilder.php:175
msgid "404 Not Found"
msgstr "404 Introuvable"
@ -180,17 +184,17 @@ msgstr "Les fichiers de l'extension \"%s\" sont introuvables."
msgid "Couldn't retrieve Updater class methods."
msgstr "Impossible de récupérer les méthodes de la classe Updater."
#: application/Updater.php:506
#: application/Updater.php:544
msgid "An error occurred while running the update "
msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour "
#: application/Updater.php:546
#: application/Updater.php:584
msgid "Updates file path is not set, can't write updates."
msgstr ""
"Le chemin vers le fichier de mise à jour n'est pas défini, impossible "
"d'écrire les mises à jour."
#: application/Updater.php:551
#: application/Updater.php:589
msgid "Unable to write updates in "
msgstr "Impossible d'écrire les mises à jour dans "
@ -230,6 +234,7 @@ msgstr ""
"Shaarli a les droits d'écriture dans le dossier dans lequel il est installé."
#: application/config/ConfigManager.php:135
#: application/config/ConfigManager.php:162
msgid "Invalid setting key parameter. String expected, got: "
msgstr "Clé de paramétrage invalide. Chaîne de caractères obtenue, attendu : "
@ -251,135 +256,133 @@ msgstr "Vous n'êtes pas autorisé à modifier la configuration."
msgid "Error accessing"
msgstr "Une erreur s'est produite en accédant à"
#: index.php:142
#: index.php:143
msgid "Shared links on "
msgstr "Liens partagés sur "
#: index.php:164
#: index.php:165
msgid "Insufficient permissions:"
msgstr "Permissions insuffisantes :"
#: index.php:303
#: index.php:304
msgid "I said: NO. You are banned for the moment. Go away."
msgstr "NON. Vous êtes banni pour le moment. Revenez plus tard."
#: index.php:368
#: index.php:369
msgid "Wrong login/password."
msgstr "Nom d'utilisateur ou mot de passe incorrects."
#: index.php:576 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:42
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:42
#: index.php:577 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:46
msgid "Daily"
msgstr "Quotidien"
#: index.php:681 tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28
#: index.php:682 tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28
#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:44
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:71
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:95
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:71
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:95
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:75
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:99
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:75
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:99
msgid "Login"
msgstr "Connexion"
#: index.php:722 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:39
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:39
#: index.php:750 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:41
msgid "Picture wall"
msgstr "Mur d'images"
#: index.php:770 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
#: index.php:798 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:36
#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19
msgid "Tag cloud"
msgstr "Nuage de tags"
#: index.php:803 tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19
#: index.php:831 tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:19
msgid "Tag list"
msgstr "Liste des tags"
#: index.php:1028 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:31
#: index.php:1056 tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:31
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:31
msgid "Tools"
msgstr "Outils"
#: index.php:1037
#: index.php:1065
msgid "You are not supposed to change a password on an Open Shaarli."
msgstr ""
"Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert."
#: index.php:1042 index.php:1084 index.php:1162 index.php:1193 index.php:1293
#: index.php:1070 index.php:1112 index.php:1189 index.php:1220 index.php:1325
msgid "Wrong token."
msgstr "Jeton invalide."
#: index.php:1047
#: index.php:1075
msgid "The old password is not correct."
msgstr "L'ancien mot de passe est incorrect."
#: index.php:1067
#: index.php:1095
msgid "Your password has been changed"
msgstr "Votre mot de passe a été modifié"
#: index.php:1072
#: index.php:1100
#: tmp/changepassword.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:29
msgid "Change password"
msgstr "Modification du mot de passe"
#: index.php:1121
#: index.php:1149
msgid "Configuration was saved."
msgstr "La configuration a été sauvegardé."
#: index.php:1145 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
#: index.php:1172 tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
msgid "Configure"
msgstr "Configurer"
#: index.php:1156 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
#: index.php:1183 tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
msgid "Manage tags"
msgstr "Gérer les tags"
#: index.php:1174
#: index.php:1201
#, php-format
msgid "The tag was removed from %d link."
msgid_plural "The tag was removed from %d links."
msgstr[0] "Le tag a été supprimé de %d lien."
msgstr[1] "Le tag a été supprimé de %d liens."
#: index.php:1175
#: index.php:1202
#, php-format
msgid "The tag was renamed in %d link."
msgid_plural "The tag was renamed in %d links."
msgstr[0] "Le tag a été renommé dans %d lien."
msgstr[1] "Le tag a été renommé dans %d liens."
#: index.php:1183 tmp/addlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
#: index.php:1210 tmp/addlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:13
msgid "Shaare a new link"
msgstr "Partager un nouveau lien"
#: index.php:1353 tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:170
#: index.php:1385 tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169
msgid "Edit"
msgstr "Modifier"
#: index.php:1353 index.php:1418
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16
#: index.php:1385 index.php:1455
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:26
msgid "Shaare"
msgstr "Shaare"
#: index.php:1387
#: index.php:1424
msgid "Note: "
msgstr "Note : "
#: index.php:1427 tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65
#: index.php:1464 tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65
msgid "Export"
msgstr "Exporter"
#: index.php:1489 tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83
#: index.php:1526 tmp/import.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83
msgid "Import"
msgstr "Importer"
#: index.php:1499
#: index.php:1536
#, php-format
msgid ""
"The file you are trying to upload is probably bigger than what this "
@ -389,16 +392,16 @@ msgstr ""
"le serveur web peut accepter (%s). Merci de l'envoyer en parties plus "
"légères."
#: index.php:1538 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
#: index.php:1575 tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
#: tmp/tools.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22
msgid "Plugin administration"
msgstr "Administration des extensions"
#: index.php:1703
#: index.php:1759
msgid "Search: "
msgstr "Recherche : "
#: index.php:1930
#: index.php:1798
#, php-format
msgid ""
"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
@ -417,7 +420,7 @@ msgstr ""
"cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse "
"IP ou un <em>Fully Qualified Domain Name</em>.<br>"
#: index.php:1940
#: index.php:1808
msgid "Click to try again."
msgstr "Cliquer ici pour réessayer."
@ -577,11 +580,11 @@ msgstr "URL de l'API Wallabag"
msgid "Wallabag API version (1 or 2)"
msgstr "Version de l'API Wallabag (1 ou 2)"
#: tests/LanguagesTest.php:188 tests/LanguagesTest.php:201
#: tests/LanguagesTest.php:214 tests/LanguagesTest.php:227
#: tests/languages/fr/LanguagesFrTest.php:160
#: tests/languages/fr/LanguagesFrTest.php:173
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:81
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:81
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:85
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:85
msgid "Search"
msgid_plural "Search"
msgstr[0] "Rechercher"
@ -625,8 +628,8 @@ msgid "Rename"
msgstr "Renommer"
#: tmp/changetag.b91ef64efc3688266305ea9b42e5017e.rtpl.php:35
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:79
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:172
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:77
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:171
msgid "Delete"
msgstr "Supprimer"
@ -736,8 +739,29 @@ msgstr ""
msgid "API secret"
msgstr "Clé d'API secrète"
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:274
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:277
msgid "Enable thumbnails"
msgstr "Activer les miniatures"
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:279
msgid "Warning: "
msgstr "Attention : "
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:281
msgid "It's recommended to visit the picture wall after enabling this feature."
msgstr ""
"Il est recommandé de visiter le Mur d'images après avoir activé cette "
"fonctionnalité."
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:283
msgid ""
"If you have a large database, the first retrieval may take a few minutes."
msgstr ""
"Si vous avez beaucoup de liens, la première récupération peut prendre "
"plusieurs minutes."
#: tmp/configure.b91ef64efc3688266305ea9b42e5017e.rtpl.php:297
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:139
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:199
msgid "Save"
@ -763,25 +787,27 @@ msgstr "Tous les liens d'un jour sur une page."
msgid "Next day"
msgstr "Jour suivant"
#: tpl/editlink.html
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14
msgid "Edit Shaare"
msgstr "Modifier le Shaare"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14
msgid "New Shaare"
msgstr "Nouveau Shaare"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:25
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23
msgid "Created:"
msgstr "Création :"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:28
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:26
msgid "URL"
msgstr "URL"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:34
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:32
msgid "Title"
msgstr "Titre"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:40
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:42
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:75
#: tmp/pluginsadmin.b91ef64efc3688266305ea9b42e5017e.rtpl.php:99
@ -789,17 +815,17 @@ msgstr "Titre"
msgid "Description"
msgstr "Description"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:46
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:44
msgid "Tags"
msgstr "Tags"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:59
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:57
#: tmp/export.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:168
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:167
msgid "Private"
msgstr "Privé"
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74
#: tmp/editlink.b91ef64efc3688266305ea9b42e5017e.rtpl.php:72
msgid "Apply Changes"
msgstr "Appliquer"
@ -876,15 +902,15 @@ msgstr ""
#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33
#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:30
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:147
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:147
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:151
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:151
msgid "Username"
msgstr "Nom d'utilisateur"
#: tmp/install.b91ef64efc3688266305ea9b42e5017e.rtpl.php:48
#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:34
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:148
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:148
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:152
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:152
msgid "Password"
msgstr "Mot de passe"
@ -901,28 +927,28 @@ msgid "Install"
msgstr "Installer"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:80
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:79
msgid "shaare"
msgid_plural "shaares"
msgstr[0] "shaare"
msgstr[1] "shaares"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:18
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:84
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:83
msgid "private link"
msgid_plural "private links"
msgstr[0] "lien privé"
msgstr[1] "liens privés"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:31
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:117
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:117
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:30
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:121
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:121
msgid "Search text"
msgstr "Recherche texte"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:124
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:124
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:37
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:128
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:128
#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:64
#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
@ -930,52 +956,52 @@ msgstr "Recherche texte"
msgid "Filter by tag"
msgstr "Filtrer par tag"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:111
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:110
msgid "Nothing found."
msgstr "Aucun résultat."
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:119
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:118
#, php-format
msgid "%s result"
msgid_plural "%s results"
msgstr[0] "%s résultat"
msgstr[1] "%s résultats"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:123
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:122
msgid "for"
msgstr "pour"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:130
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:129
msgid "tagged"
msgstr "taggé"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:134
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:133
msgid "Remove tag"
msgstr "Retirer le tag"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:143
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:142
msgid "with status"
msgstr "avec le statut"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:154
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:153
msgid "without any tag"
msgstr "sans tag"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:174
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:173
#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:42
#: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:42
msgid "Fold"
msgstr "Replier"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:176
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:175
msgid "Edited: "
msgstr "Modifié : "
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:180
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:179
msgid "permalink"
msgstr "permalien"
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:182
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:181
msgid "Add tag"
msgstr "Ajouter un tag"
@ -1021,8 +1047,8 @@ msgstr ""
"réessayer plus tard."
#: tmp/loginform.b91ef64efc3688266305ea9b42e5017e.rtpl.php:41
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:151
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:151
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:155
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:155
msgid "Remember me"
msgstr "Rester connecté"
@ -1053,35 +1079,40 @@ msgstr "Déplier tout"
msgid "Are you sure you want to delete this link?"
msgstr "Êtes-vous sûr de vouloir supprimer ce lien ?"
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:61
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:86
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:61
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:86
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:65
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:90
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:65
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:90
msgid "RSS Feed"
msgstr "Flux RSS"
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:66
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:102
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:66
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:102
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:70
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:106
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:70
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:106
msgid "Logout"
msgstr "Déconnexion"
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:169
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:169
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:173
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:173
msgid "is available"
msgstr "est disponible"
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:176
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:176
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:180
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:180
msgid "Error"
msgstr "Erreur"
#: tmp/picwall.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16
#: tmp/picwall.b91ef64efc3688266305ea9b42e5017e.rtpl.php:14
msgid "Picture wall unavailable (thumbnails are disabled)."
msgstr ""
"Le mur d'images n'est pas disponible (les miniatures sont désactivées)."
#: tmp/picwall.b91ef64efc3688266305ea9b42e5017e.rtpl.php:25
msgid "Picture Wall"
msgstr "Mur d'images"
#: tmp/picwall.b91ef64efc3688266305ea9b42e5017e.rtpl.php:16
#: tmp/picwall.b91ef64efc3688266305ea9b42e5017e.rtpl.php:25
msgid "pics"
msgstr "images"

View file

@ -3,7 +3,10 @@
"default": {
"_comment": "infinite cache",
"cache_duration": -1,
"timeout": 60
"timeout": 10
},
"path": {
"cache": "cache/"
}
}
}

View file

@ -74,13 +74,13 @@ require_once 'application/Url.php';
require_once 'application/Utils.php';
require_once 'application/PluginManager.php';
require_once 'application/Router.php';
require_once 'application/Thumbnailer.php';
require_once 'application/Updater.php';
use \Shaarli\Languages;
use \Shaarli\ThemeUtils;
use \Shaarli\Config\ConfigManager;
use \Shaarli\Languages;
use \Shaarli\Security\LoginManager;
use \Shaarli\Security\SessionManager;
use \Shaarli\ThemeUtils;
use \Shaarli\Thumbnailer;
// Ensure the PHP version is supported
try {
@ -603,7 +603,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
if ($targetPage == Router::$PAGE_PICWALL)
{
if (! $conf->get('thumbnails.enabled')) {
header('Location: ?');
$PAGE->renderPage('picwall');
exit;
}
@ -614,23 +614,19 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
$thumbnailer = new Thumbnailer($conf);
$cpt = 0;
$newThumbnailsCpt = 0;
// Get only links which have a thumbnail.
foreach($links as $link)
foreach($links as $key => $link)
{
$permalink='?'.$link['shorturl'];
// Not a note,
// and (never retrieved yet or no valid cache file)
if ($link['url'][0] != '?'
&& (! isset($link['thumbnail']) || ($link['thumbnail'] !== false && ! is_file($link['thumbnail'])))
) {
$link['thumbnail'] = $thumbnailer->get($link['url']);
// FIXME! we really need to get rid of ArrayAccess...
$item = $LINKSDB[$link['linkdate']];
$item['thumbnail'] = $link['thumbnail'];
$LINKSDB[$link['linkdate']] = $item;
$updateDB = true;
$cpt++;
$item = $LINKSDB[$key];
$item['thumbnail'] = $thumbnailer->get($link['url']);
$LINKSDB[$key] = $item;
$newThumbnailsCpt++;
}
if (isset($link['thumbnail']) && $link['thumbnail'] !== false) {
@ -639,14 +635,13 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
// If we retrieved new thumbnails, we update the database every 20 links.
// Downloading everything the first time may take a very long time
if (!empty($updateDB) && $cpt == 20) {
if ($newThumbnailsCpt == 20) {
$LINKSDB->save($conf->get('resource.page_cache'));
$updateDB = false;
$cpt = 0;
$newThumbnailsCpt = 0;
}
}
if (!empty($updateDB)) {
if ($newThumbnailsCpt > 0) {
$LINKSDB->save($conf->get('resource.page_cache'));
}
@ -1619,11 +1614,9 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
if ($conf->get('thumbnails.enabled') && $link['url'][0] != '?'
&& (! isset($link['thumbnail']) || ($link['thumbnail'] !== false && ! is_file($link['thumbnail'])))
) {
$link['thumbnail'] = $thumbnailer->get($link['url']);
// FIXME! we really need to get rid of ArrayAccess...
$item = $LINKSDB[$keys[$i]];
$item['thumbnail'] = $link['thumbnail'];
$LINKSDB[$keys[$i]] = $item;
$elem = $LINKSDB[$keys[$i]];
$elem['thumbnail'] = $thumbnailer->get($link['url']);
$LINKSDB[$keys[$i]] = $elem;
$updateDB = true;
}

View file

@ -1,7 +1,10 @@
<?php
require_once 'application/Thumbnailer.php';
require_once 'application/config/ConfigManager.php';
namespace Shaarli;
use PHPUnit\Framework\TestCase;
use Shaarli\Config\ConfigManager;
use WebThumbnailer\Application\ConfigManager as WTConfigManager;
/**
* Class ThumbnailerTest
@ -11,31 +14,48 @@ require_once 'application/config/ConfigManager.php';
* 1. the thumbnailer library is itself tested
* 2. we don't want to make too many external requests during the tests
*/
class ThumbnailerTest extends PHPUnit_Framework_TestCase
class ThumbnailerTest extends TestCase
{
const WIDTH = 190;
const HEIGHT = 210;
/**
* @var Thumbnailer;
*/
protected $thumbnailer;
public function setUp()
{
$conf = new ConfigManager('tests/utils/config/configJson');
$conf->set('thumbnails.width', self::WIDTH);
$conf->set('thumbnails.height', self::HEIGHT);
$conf->set('dev.debug', true);
$this->thumbnailer = new Thumbnailer($conf);
// cache files in the sandbox
WTConfigManager::addFile('tests/utils/config/wt.json');
}
public function tearDown()
{
$this->rrmdirContent('sandbox/');
}
/**
* Test a thumbnail with a custom size.
*/
public function testThumbnailValid()
{
$conf = new ConfigManager('tests/utils/config/configJson');
$width = 200;
$height = 200;
$conf->set('thumbnails.width', $width);
$conf->set('thumbnails.height', $height);
$thumbnailer = new Thumbnailer($conf);
$thumb = $thumbnailer->get('https://github.com/shaarli/Shaarli/');
$thumb = $this->thumbnailer->get('https://github.com/shaarli/Shaarli/');
$this->assertNotFalse($thumb);
$image = imagecreatefromstring(file_get_contents($thumb));
$this->assertEquals($width, imagesx($image));
$this->assertEquals($height, imagesy($image));
$this->assertEquals(self::WIDTH, imagesx($image));
$this->assertEquals(self::HEIGHT, imagesy($image));
}
/**
* Test a thumbnail that can't be retrieved.
*
* @expectedException WebThumbnailer\Exception\ThumbnailNotFoundException
*/
public function testThumbnailNotValid()
{
@ -48,4 +68,18 @@ class ThumbnailerTest extends PHPUnit_Framework_TestCase
ini_set('error_log', $oldlog);
}
protected function rrmdirContent($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."/".$object))
$this->rrmdirContent($dir."/".$object);
else
unlink($dir."/".$object);
}
}
}
}
}

View file

@ -684,4 +684,19 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
$this->assertEquals(4194304, $this->conf->get('general.download_max_size'));
$this->assertEquals(3, $this->conf->get('general.download_timeout'));
}
/**
* Test updateMethodAtomDefault with show_atom set to true.
* => nothing to do
*/
public function testUpdateMethodWebThumbnailerEnabled()
{
$this->conf->set('thumbnail.enable_thumbnails', true);
$updater = new Updater([], [], $this->conf, true);
$this->assertTrue($updater->updateMethodWebThumbnailer());
$this->assertFalse($this->conf->exists('thumbnail'));
$this->assertTrue($this->conf->get('thumbnails.enabled'));
$this->assertEquals(125, $this->conf->get('thumbnails.width'));
$this->assertEquals(90, $this->conf->get('thumbnails.height'));
}
}

View file

@ -1,38 +1,84 @@
<?php /*
{
"credentials": {
"login":"root",
"hash":"hash",
"salt":"salt"
"login": "root",
"hash": "hash",
"salt": "salt"
},
"security": {
"session_protection_disabled":false
"session_protection_disabled": false,
"ban_after": 4,
"ban_duration": 1800,
"open_shaarli": false,
"allowed_protocols": [
"ftp",
"ftps",
"magnet"
]
},
"general": {
"timezone":"Europe\/Paris",
"timezone": "Europe\/Paris",
"title": "Shaarli",
"header_link": "?"
"header_link": "?",
"links_per_page": 20,
"enabled_plugins": [
"qrcode"
],
"default_note_title": "Note: "
},
"privacy": {
"default_private_links":true
"default_private_links": true,
"hide_public_links": false,
"force_login": false,
"hide_timestamps": false,
"remember_user_default": true
},
"redirector": {
"url":"lala"
"url": "lala",
"encode_url": true
},
"config": {
"foo": "bar"
},
"resource": {
"datastore": "tests\/utils\/config\/datastore.php",
"data_dir": "sandbox/",
"raintpl_tpl": "tpl/"
"data_dir": "sandbox\/",
"raintpl_tpl": "tpl\/",
"config": "data\/config.php",
"ban_file": "data\/ipbans.php",
"updates": "data\/updates.txt",
"log": "data\/log.txt",
"update_check": "data\/lastupdatecheck.txt",
"history": "data\/history.php",
"theme": "default",
"raintpl_tmp": "tmp\/",
"thumbnails_cache": "cache",
"page_cache": "pagecache"
},
"plugins": {
"WALLABAG_VERSION": 1
},
"dev": {
"debug": true
},
"thumbnails": {
"enabled": true,
"width": 125,
"height": 90
},
"updates": {
"check_updates": false,
"check_updates_branch": "stable",
"check_updates_interval": 86400
},
"feed": {
"rss_permalinks": true,
"show_atom": true
},
"translation": {
"language": "auto",
"mode": "php",
"extensions": []
}
}
*/ ?>
*/ ?>

View file

@ -0,0 +1,12 @@
{
"settings": {
"default": {
"_comment": "infinite cache",
"cache_duration": -1,
"timeout": 10
},
"path": {
"cache": "sandbox/"
}
}
}

View file

@ -242,6 +242,26 @@
</div>
</div>
</div>
<div class="pure-g">
<div class="pure-u-lg-{$ratioLabel} pure-u-{$ratioLabelMobile}">
<div class="form-label">
<label for="enableThumbnails">
<span class="label-name">{'Enable thumbnails'|t}</span><br>
<span class="label-desc">
{'Warning: '|t}
{'It\'s recommended to visit the picture wall after enabling this feature.'|t}
{'If you have a large database, the first retrieval may take a few minutes.'|t}
</span>
</label>
</div>
</div>
<div class="pure-u-lg-{$ratioInput} pure-u-{$ratioInputMobile}">
<div class="form-input">
<input type="checkbox" name="enableThumbnails" id="enableThumbnails"
{if="$thumbnails_enabled"}checked{/if}/>
</div>
</div>
</div>
<div class="center">
<input type="submit" value="{'Save'|t}" name="save">
</div>

View file

@ -131,9 +131,17 @@
<div class="linklist-item linklist-item{if="$value.class"} {$value.class}{/if}" data-id="{$value.id}">
<div class="linklist-item-title">
{$thumb=thumbnail($value.url)}
{if="$thumb!=false"}
<div class="linklist-item-thumbnail">{$thumb}</div>
{if="$thumbnails_enabled && !empty($value.thumbnail)"}
<div class="linklist-item-thumbnail">
<div class="thumbnail">
<a href="{$value.real_url}">
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
<img data-src="{$value.thumbnail}#" class="b-lazy"
src="#"
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
</a>
</div>
</div>
{/if}
{if="$is_logged_in"}
@ -268,5 +276,6 @@
</div>
{include="page.footer"}
<script src="js/thumbnails.min.js?v={$version_hash}"></script>
</body>
</html>

View file

@ -30,9 +30,11 @@
<li class="pure-menu-item" id="shaarli-menu-tags">
<a href="?do=tagcloud" class="pure-menu-link">{'Tag cloud'|t}</a>
</li>
<li class="pure-menu-item" id="shaarli-menu-picwall">
<a href="?do=picwall{$searchcrits}" class="pure-menu-link">{'Picture wall'|t}</a>
</li>
{if="$thumbnails_enabled"}
<li class="pure-menu-item" id="shaarli-menu-picwall">
<a href="?do=picwall{$searchcrits}" class="pure-menu-link">{'Picture wall'|t}</a>
</li>
{/if}
<li class="pure-menu-item" id="shaarli-menu-daily">
<a href="?do=daily" class="pure-menu-link">{'Daily'|t}</a>
</li>

View file

@ -5,41 +5,53 @@
</head>
<body>
{include="page.header"}
<div class="pure-g">
<div class="pure-u-lg-1-6 pure-u-1-24"></div>
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countPics=count($linksToDisplay)}
<h2 class="window-title">{'Picture Wall'|t} - {$countPics} {'pics'|t}</h2>
<div id="plugin_zone_start_picwall" class="plugin_zone">
{loop="$plugin_start_zone"}
{$value}
{/loop}
</div>
<div id="picwall_container" class="picwall-container">
{loop="$linksToDisplay"}
<div class="picwall-pictureframe">
{$value.thumbnail}<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
{loop="$value.picwall_plugin"}
{$value}
{/loop}
</div>
{/loop}
<div class="clear"></div>
</div>
<div id="plugin_zone_end_picwall" class="plugin_zone">
{loop="$plugin_end_zone"}
{$value}
{/loop}
</div>
{if="!$thumbnails_enabled"}
<div class="pure-g pure-alert pure-alert-warning page-single-alert">
<div class="pure-u-1 center">
{'Picture wall unavailable (thumbnails are disabled).'|t}
</div>
</div>
{else}
<div class="pure-g">
<div class="pure-u-lg-1-6 pure-u-1-24"></div>
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countPics=count($linksToDisplay)}
<h2 class="window-title">{'Picture Wall'|t} - {$countPics} {'pics'|t}</h2>
<div id="plugin_zone_start_picwall" class="plugin_zone">
{loop="$plugin_start_zone"}
{$value}
{/loop}
</div>
<div id="picwall_container" class="picwall-container">
{loop="$linksToDisplay"}
<div class="picwall_pictureframe">
{ignore}RainTPL hack: put the 2 src on two different line to avoid path replace bug{/ignore}
<img data-src="{$value.thumbnail}#" class="b-lazy"
src="#"
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
<a href="{$value.real_url}"><span class="info">{$value.title}</span></a>
{loop="$value.picwall_plugin"}
{$value}
{/loop}
</div>
{/loop}
<div class="clear"></div>
</div>
<div id="plugin_zone_end_picwall" class="plugin_zone">
{loop="$plugin_end_zone"}
{$value}
{/loop}
</div>
</div>
<div class="pure-u-lg-1-6 pure-u-1-24"></div>
</div>
{/if}
{include="page.footer"}
<script src="js/picwall.min.js?v={$version_hash}"></script>
<script src="js/thumbnails.min.js?v={$version_hash}"></script>
</body>
</html>

View file

@ -154,6 +154,7 @@
</div>
{include="page.footer"}
<script src="js/thumbnails.min.js"></script>
</body>
</html>

View file

@ -38,6 +38,6 @@
{include="page.footer"}
<script src="js/picwall.min.js"></script>
<script src="js/thumbnails.min.js"></script>
</body>
</html>

View file

@ -23,7 +23,7 @@ const extractCssVintage = new ExtractTextPlugin({
module.exports = [
{
entry: {
picwall: './assets/common/js/picwall.js',
thumbnails: './assets/common/js/thumbnails.js',
pluginsadmin: './assets/default/js/plugins-admin.js',
shaarli: [
'./assets/default/js/base.js',
@ -96,7 +96,7 @@ module.exports = [
'./assets/vintage/css/reset.css',
'./assets/vintage/css/shaarli.css',
].concat(glob.sync('./assets/vintage/img/*')),
picwall: './assets/common/js/picwall.js',
thumbnails: './assets/common/js/thumbnails.js',
},
output: {
filename: '[name].min.js',