From b0049e8bea38273dd53c12bd5b0baa49b95c7157 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 16 Mar 2025 10:17:00 +0100 Subject: [PATCH] fixed confusing wording about thumbnail. Removed page thumbnail generation with google page insights. Signed-off-by: Banana --- CHANGELOG | 1 + TODO | 2 -- documentation/thumbnail-of-link.md | 10 ------ webroot/lib/lang/eng.lang.ini | 11 +++--- webroot/lib/lang/ger.lang.ini | 11 +++--- webroot/lib/link.class.php | 57 ++---------------------------- webroot/lib/snapshot.class.php | 51 +------------------------- webroot/view/editlink.inc.php | 7 +--- webroot/view/editlink.php | 22 ++---------- webroot/view/linkinfo.php | 6 ++-- 10 files changed, 19 insertions(+), 159 deletions(-) delete mode 100644 documentation/thumbnail-of-link.md diff --git a/CHANGELOG b/CHANGELOG index cc32284..a3a96e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ version 2.x.x - Griffin Chapel () + New home screen layout + Better logging + Changed documentation files to markdown syntax. + + Removed page thumbnail creation. version 2.8.2 - Dragon Chapel (2023-09-14) diff --git a/TODO b/TODO index f878d5c..f85c330 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,4 @@ TODO / Feature list -+ google api call needs an api key now. Add or remove? -++ Also change the wording here. Thumbnail vs. preview thumbnail and hole page screenshot + combine category and tag class into one. + installer + view table really still needed? diff --git a/documentation/thumbnail-of-link.md b/documentation/thumbnail-of-link.md deleted file mode 100644 index 35d6aa6..0000000 --- a/documentation/thumbnail-of-link.md +++ /dev/null @@ -1,10 +0,0 @@ -# Thumbnails - -While editing a link you can request thumbnail of the given link at the time. -It uses the Google page insights API to get a thumbnail. - -It will be created if the option is activated. To remove uncheck the option at entry creation. -To refresh uncheck the option. Save. This will delete the data. Check the option again and the thumbnail will be created again. - -Any error in this process will be visible in the error log file and not visible in the client. This way the link will be saved -and no data will be lost. diff --git a/webroot/lib/lang/eng.lang.ini b/webroot/lib/lang/eng.lang.ini index 07f5dcf..eacc1ce 100644 --- a/webroot/lib/lang/eng.lang.ini +++ b/webroot/lib/lang/eng.lang.ini @@ -38,10 +38,7 @@ edit.link.updated = "Link updated successfully." edit.link.update.failed = "Link updated failed. See logs for more details." edit.link.update.title.missing = "Please provide a title." edit.link.last.update = "Last update" -edit.link.image.save = "Save image on the server" -edit.link.thumbnail.webpage = "Thumbnail of the webpage. Not the image provided with html meta data." -edit.link.thumbnail.view = "View Thumbnail" -edit.link.thumbnail.save = "Save a thumbnail (This can take some time)" +edit.link.image.save = "Save meta tag thumbnail on the server" edit.link.full.screenshot = "Full page screenshot." edit.link.full.screenshot.view = "View page screenshot" edit.link.full.screenshot.save = "Save a full page screenshot (This can take some time)" @@ -94,9 +91,9 @@ view.tags = "Tags" view.tag.topcombination = "Top tag combinations" view.private = "Private" view.url = "URL" -view.image = "Image" -view.image.provided = "If provided" -view.image.noimage = "No image provided" +view.website.thumbnail = "Website thumbnail from meta tag" +view.website.thumbnail.provided = "If available" +view.website.thumbnail.noimage = "No meta thumbnail provided" view.date.added = "Date added" view.edit = "Edit" view.export = "Export" diff --git a/webroot/lib/lang/ger.lang.ini b/webroot/lib/lang/ger.lang.ini index be20901..eb8258c 100644 --- a/webroot/lib/lang/ger.lang.ini +++ b/webroot/lib/lang/ger.lang.ini @@ -38,10 +38,7 @@ edit.link.updated = "Link erfolgreich aktualisiert." edit.link.update.failed = "Link Aktualisierung fehlgeschlagen. Mehr Informationen in den Logdateien." edit.link.update.title.missing = "Bitte einen Titel angeben." edit.link.last.update = "Letzte Aktualisierung" -edit.link.image.save = "Bild auf dem Server speichern" -edit.link.thumbnail.webpage = "Thumbnail der Webseite. Nicht die Metaeigenschaft aus HTML." -edit.link.thumbnail.view = "Thumbnail ansehen" -edit.link.thumbnail.save = "Thumbnail erstellen und speichern. (Kann etwas Zeit in Anspruch nehmen)" +edit.link.image.save = "Meta tag thumnail Bild abspeichern" edit.link.full.screenshot = "Screenshot der ganzen Webseite." edit.link.full.screenshot.view = "Webseitenscreenshot anzeigen" edit.link.full.screenshot.save = "Screenshot der ganzen Webseite auf dem Server speichern (Kann etwas Zeit in Anspruch nehmen)" @@ -94,9 +91,9 @@ view.tags = "Tags" view.tag.topcombination = "Top Tag Kombinationen" view.private = "Privat" view.url = "URL" -view.image = "Bild" -view.image.provided = "Wenn vorhanden" -view.image.noimage = "Kein Bild vorhanden" +view.website.thumbnail = "Webseiten meta tag Thumbnail" +view.website.thumbnail.provided = "Wenn vorhanden" +view.website.thumbnail.noimage = "Kein meta tag Thumnail Bild vorhanden" view.date.added = "Hinzugefügt am" view.edit = "Bearbeiten" view.export = "Export" diff --git a/webroot/lib/link.class.php b/webroot/lib/link.class.php index c14e8ad..7d2f35c 100644 --- a/webroot/lib/link.class.php +++ b/webroot/lib/link.class.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2023 Johannes Keßler + * Copyright 2016-2025 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -89,8 +89,7 @@ class Link { $this->_tags(); $this->_categories(); $this->_image(); - $this->_private(); - $this->_snapshot(); + $this->_private();; $this->_pageScreenshot(); } } catch (Exception $e) { @@ -325,27 +324,6 @@ class Link { } } - # decide if we want to make a local snapshot - if(isset($data['snapshot'])) { - $snapshot = ABSOLUTE_PATH . '/' . LOCAL_STORAGE . '/snapshot-' . $this->_data['hash'].'.webp'; - if ($data['snapshot'] === true) { - if (!file_exists($snapshot) || $_imageUrlChanged === true) { - require_once 'lib/snapshot.class.php'; - $snap = new Snapshot(); - $do = $snap->doSnapshot($this->_data['link'], $snapshot); - if(empty($do)) { - Summoner::sysLog('ERROR Failed to create snapshot: '.Summoner::cleanForLog($data)); - } - } - } elseif ($data['snapshot'] === false) { - if(DEBUG) Summoner::sysLog("DEBUG want to remove local snapshot: $snapshot"); - if (file_exists($snapshot)) { - if(DEBUG) Summoner::sysLog("DEBUG remove local snapshot: $snapshot"); - unlink($snapshot); - } - } - } - # decide if we want to make a local full page screenshot if(isset($data['pagescreenshot'])) { $pagescreenshot = ABSOLUTE_PATH . '/' . LOCAL_STORAGE . '/pagescreenshot-' . $this->_data['hash'].'.jpeg'; @@ -388,7 +366,6 @@ class Link { $this->_removeTagRelation(); $this->_removeCategoryRelation(); $this->_deleteImage(); - $this->_deleteSnapshot(); $this->_deletePageScreenshot(); } @@ -542,22 +519,6 @@ class Link { } } - /** - * determine if we have a local stored snapshot - * if so populate the snapshotLink attribute - * - * @return void - */ - private function _snapshot(): void { - if (!empty($this->_data['hash'])) { - $snapshot = ABSOLUTE_PATH.'/'.LOCAL_STORAGE.'/snapshot-'.$this->_data['hash'].'.webp'; - if (file_exists($snapshot)) { - $this->_data['snapshotLink'] = LOCAL_STORAGE.'/snapshot-'.$this->_data['hash'].'.webp'; - $this->_data['snapshot'] = true; - } - } - } - /** * determine if we have a local full page screenshot * if so populate the pagescreenshotLink attribute @@ -588,20 +549,6 @@ class Link { } } - /** - * remove the local stored snapshot - * - * @return void - */ - private function _deleteSnapshot(): void { - if (!empty($this->_data['hash']) && !empty($this->_data['snapshotLink'])) { - $snapshot = LOCAL_STORAGE.'/snapshot-'.$this->_data['hash'].'.webp'; - if (file_exists($snapshot)) { - unlink($snapshot); - } - } - } - /** * remove the local stored pagescreenshot * diff --git a/webroot/lib/snapshot.class.php b/webroot/lib/snapshot.class.php index 4b807f0..41edb86 100644 --- a/webroot/lib/snapshot.class.php +++ b/webroot/lib/snapshot.class.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2023 Johannes Keßler + * Copyright 2016-2025 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -34,60 +34,12 @@ * */ class Snapshot { - /** - * @var string - */ - private string $_googlePageSpeed = 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url='; /** * Snapshot constructor */ public function __constructor(): void {} - /** - * call given url with google PageSpeed API - * to receive image data - * - * @param String $url URL to take a thumbnail from - * @param string $filename - * @return boolean - */ - public function doSnapshot(string $url, string $filename): bool { - $ret = false; - - if(!empty($url) && is_writable(dirname($filename))) { - if(DEBUG) { - Summoner::sysLog("DEBUG try to save to $filename with $this->_googlePageSpeed for $url"); - } - $theCall = Summoner::curlCall($this->_googlePageSpeed.urlencode($url).'&screenshot=true'); - if(!empty($theCall['status'])) { - $jsonData = json_decode($theCall['message'],true); - if(DEBUG) { - Summoner::sysLog("DEBUG Call result data: ".Summoner::cleanForLog($jsonData)); - } - if(!empty($jsonData) && isset($jsonData['lighthouseResult']['fullPageScreenshot']['screenshot']['data'])) { - $imageData = $jsonData['lighthouseResult']['fullPageScreenshot']['screenshot']['data']; - - $source = fopen($imageData, 'r'); - $destination = fopen($filename, 'w'); - if(stream_copy_to_stream($source, $destination)) { - $ret = $filename; - } - fclose($source); - fclose($destination); - } elseif(DEBUG) { - Summoner::sysLog("DEBUG invalid json data. Path ['lighthouseResult']['fullPageScreenshot']['screenshot']['data'] not found in : ".Summoner::cleanForLog($jsonData)); - } - } elseif(DEBUG) { - Summoner::sysLog("DEBUG curl call failed ".Summoner::cleanForLog($theCall)); - } - } else { - Summoner::sysLog("ERROR URL $url is empty or target $filename is not writeable."); - } - - return $ret; - } - /** * use configured COMPLETE_PAGE_SCREENSHOT_COMMAND to create a whole page screenshot * of the given link and store it locally @@ -155,4 +107,3 @@ class Snapshot { return $ret; } } - diff --git a/webroot/view/editlink.inc.php b/webroot/view/editlink.inc.php index 48453c7..218608f 100644 --- a/webroot/view/editlink.inc.php +++ b/webroot/view/editlink.inc.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2022 Johannes Keßler + * Copyright 2016-2025 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -105,11 +105,6 @@ if(isset($_POST['data']) && !empty($_POST['data']) && isset($_POST['editlink'])) $formData['localImage'] = true; } - $formData['snapshot'] = false; - if(isset($fData['snapshot'])) { - $formData['snapshot'] = true; - } - $formData['pagescreenshot'] = false; if(isset($fData['pagescreenshot'])) { $formData['pagescreenshot'] = true; diff --git a/webroot/view/editlink.php b/webroot/view/editlink.php index 1ae23b6..e3b5370 100644 --- a/webroot/view/editlink.php +++ b/webroot/view/editlink.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2022 Johannes Keßler + * Copyright 2016-2025 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -83,12 +83,12 @@

- t('view.image'); ?>: (t('view.image.provided'); ?>) + t('view.website.thumbnail'); ?> (t('view.website.thumbnail.provided'); ?>)

- <?php echo $T->t('view.image.noimage'); ?> + <?php echo $T->t('view.website.thumbnail.noimage'); ?>



@@ -98,22 +98,6 @@
-
-
-

- t('edit.link.thumbnail.webpage'); ?> -

-
-
- -

t('edit.link.thumbnail.view'); ?>

- - -
-
diff --git a/webroot/view/linkinfo.php b/webroot/view/linkinfo.php index bb47c0b..2e65243 100644 --- a/webroot/view/linkinfo.php +++ b/webroot/view/linkinfo.php @@ -3,7 +3,7 @@ * Insipid * Personal web-bookmark-system * - * Copyright 2016-2021 Johannes Keßler + * Copyright 2016-2025 Johannes Keßler * * Development starting from 2011: Johannes Keßler * https://www.bananas-playground.net/projekt/insipid/ @@ -66,12 +66,12 @@

- t('view.image'); ?> (t('view.image.provided'); ?>) + t('view.website.thumbnail'); ?> (t('view.website.thumbnail.provided'); ?>)

- <?php echo $T->t('view.image.provided'); ?> + <?php echo $T->t('view.website.thumbnail.noimage'); ?>

-- 2.39.5