Improve link preview

This commit is contained in:
Jay Trees 2022-04-08 10:42:40 +02:00
parent 7f92659891
commit bdda09cf17
3 changed files with 16 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -8,8 +8,8 @@
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="link-preview.svg"
inkscape:export-filename="C:\laragon\www\wishthis\src\assets\img\logo-square-white-background.png"
sodipodi:docname="default.svg"
inkscape:export-filename="C:\laragon\www\wishthis\src\assets\img\link-preview.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
@ -27,7 +27,7 @@
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.27496367"
inkscape:cx="141.83692"
inkscape:cx="74.555304"
inkscape:cy="1087.4164"
inkscape:window-width="1920"
inkscape:window-height="1027"

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -111,8 +111,9 @@ class Page
*/
public function __construct(string $filepath, public string $title = 'wishthis', public int $power = 0)
{
$this->name = pathinfo($filepath, PATHINFO_FILENAME);
$this->description = __('wishthis is a simple, intuitive and modern wishlist platform to create, manage and view your wishes for any kind of occasion.');
$this->name = pathinfo($filepath, PATHINFO_FILENAME);
$this->description = __('wishthis is a simple, intuitive and modern wishlist platform to create, manage and view your wishes for any kind of occasion.');
$this->link_preview = 'https://' . $_SERVER['HTTP_HOST'] . '/src/assets/img/link-previews/default.png';
/**
* Session
@ -191,6 +192,16 @@ class Page
__('Development environment')
);
}
/**
* Link preview
*/
$screenshot_filepath = ROOT . '/src/assets/img/screenshots/' . $this->name . '.png';
$screenshot_url = 'https://' . $_SERVER['HTTP_HOST'] . '/src/assets/img/screenshots/' . $this->name . '.png';
if (file_exists($screenshot)) {
$this->link_preview = $screenshot_url;
}
}
public function header(): void