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.
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
function createImage( $srcImg, $width, $height )
{
if( !is_resource($srcImg) || get_resource_type($srcImg) != 'gd' || !getimagesize($srcImg, $srcImg_info) ) {
return false;
}
$dstImg = imagecreatetruecolor($width, $height);
imagecopyresampled($dstImg, $srcImg, 0, 0, 0, 0, $width, $height, $srcImg_info[0], $srcimg_info[1]);
return $dstImg;
}
function upload_picture( $srdFilepath, $nick )
{
if( !file_exists($srcFilepath) || !is_readable($srcFilepath) ) {
return false;
}
$filename = $nick.'_'.time().'.jpg';
$imgDir = '/user_uploads/pictures';
$thumbDir = '/user_uploads/pictures/thumbnails';
$dstImg = createImage(ImageCreateFromJPEG($srcFilepath), 200, 250);
Imagejpeg($dstImg, $thumbDir.'/'.$filename, 72);
ImageDestroy($dstImg);
$dstImg = createImage(ImageCreateFromJPEG($srcFilepath), 640, 480);
Imagejpeg($dstImg, $imgDir.'/'.$filename, 72);
ImageDestroy($dstImg);
}
upload_picture($_FILES['file']['tmp_name'], 'foobar');
?>
Warning: getimagesize(Resource id #5): failed to open stream: No such file or directory in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 37
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 53
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 54
Warning: getimagesize(Resource id #7): failed to open stream: No such file or directory in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 37
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 57
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 58
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
function createImage( $srcImg, $width, $height, $srcImg_info)
{
if( !is_resource($srcImg) || get_resource_type($srcImg) != 'gd' || !is_array($srcImg_info) ) {
return false;
}
$dstImg = imagecreatetruecolor($width, $height);
imagecopyresampled($dstImg, $srcImg, 0, 0, 0, 0, $width, $height, $srcImg_info[0], $srcimg_info[1]);
return $dstImg;
}
function upload_picture( $srcFilepath, $nick )
{
if( !file_exists($srcFilepath) || !is_readable($srcFilepath) ) {
return false;
}
$filename = $nick.'_'.time().'.jpg';
$imgDir = '/user_uploads/pictures';
$thumbDir = '/user_uploads/pictures/thumbnails';
$srcImg_info = getimagesize($srdFilepath);
$dstImg = createImage(ImageCreateFromJPEG($srcFilepath), 200, 250,$srcImg_info);
Imagejpeg($dstImg, $thumbDir.'/'.$filename, 72);
ImageDestroy($dstImg);
$dstImg = createImage(ImageCreateFromJPEG($srcFilepath), 640, 480,$srcImg_info);
Imagejpeg($dstImg, $imgDir.'/'.$filename, 72);
ImageDestroy($dstImg);
}
upload_picture($_FILES['file']['tmp_name'], 'foobar');
?>
Notice: Undefined variable: srcFilepath in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 48
...
if( !file_exists($srcFilepath) || !is_readable($srcFilepath) ) {
...
Notice: Undefined variable: srcFilepath in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 57
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 58
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 59
Notice: Undefined variable: srcFilepath in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 61
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 62
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 63
Notice: Undefined variable: srcFilepath in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 57
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 58
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 59
Notice: Undefined variable: srcFilepath in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 61
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 62
Warning: imagedestroy(): supplied argument is not a valid Image resource in /usr/export/www/hosting/ruelingpunks/html_design_neu/html/_functions.php on line 63