Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
$image->embedImage($watermarkpath, $position, $border_padding);
// hier resize
$image->embedImage('/srv/www/vhosts/thuet.de/httpdocs/watermark.png', 3, 8);
$image->render('jpg');
<?php
ini_set('error_reporting', 'on');
error_reporting(E_ALL);
define('THIS_DIR', realpath(dirname(__FILE__)) . '/');
if (empty($_GET['wallpaper']) OR !ctype_digit($_GET['wallpaper'])) {
die('Ungültige Bilddatei!');
}
// Format ermitteln
$size = (!empty($_GET['size'])) ? $_GET['size'] : null;
// wide format --> nein
$wide = false;
switch ($size) {
case 'thumbnail':
$x = 150;
$y = 96;
break;
default:
case 'preview':
$x = 500;
$y = 375;
break;
case '800':
case '800x600':
$x = 800;
$y = 600;
break;
case '1024':
case '1024x768':
$x = 1024;
$y = 768;
break;
case '1280_2':
case '1280x800':
// wide format --> ja
$wide = true;
$x = 1280;
$y = 800;
break;
case '1280_1':
case '1280x960':
$x = 1280;
$y = 960;
break;
case '1280':
case '1280x1024':
$x = 1280;
$y = 1024;
break;
case '1600':
case '1600x1200':
$x = 1600;
$y = 1200;
break;
case '1680':
case '1680x1050':
// wide format --> ja
$wide = true;
$x = 1680;
$y = 1050;
break;
case '1920':
case '1920x1200':
// wide format --> ja
$wide = true;
$x = 1920;
$y = 1200;
break;
}
// Pfad zur Bilddatei konstruieren
if ($wide == true) {
$path = realpath(dirname(__FILE__) . "/wallpapers/{$_GET['wallpaper']}-wide.jpg");
if (!is_readable($path)) {
$path = realpath(dirname(__FILE__) . "/wallpapers/{$_GET['wallpaper']}.jpg");
}
} else {
$path = realpath(dirname(__FILE__) . "/wallpapers/{$_GET['wallpaper']}.jpg");
}
// und prüfen
if (!is_readable($path)) {
die('Quelldatei nicht gefunden!');
}
// Klassen einbinden
require_once(THIS_DIR . 'library/class.image.php');
require_once(THIS_DIR . 'library/class.validate.php');
// Objekt instanzieren
$image = new Image($path);
// resize
$image->resizeCanvas($x, $y, 'fit');
// Renderqualität
$image->setRenderQuality(90);
// ausgeben
$image->render('jpg');
<img border="2" src="/wallpaperview.php?wallpaper=0300000001&size=preview">
<img border="2" src="/wallpaperview.php?wallpaper=0300000001&size=thumbnail">
switch ($size) {
case 'thumbnail':
$x = 94;
$y = 70;
break;
default:
case 'preview':
$x = 624;
$y = 468;
break;
case '1920_1':
case '1920x1440':
$x = 1920;
$y = 1440;
break;