added orai
This commit is contained in:
parent
4d0bd470bb
commit
52e5ec300e
BIN
20241118/kilenc/Vera.ttf
Normal file
BIN
20241118/kilenc/Vera.ttf
Normal file
Binary file not shown.
94
20241118/kilenc/head.php
Normal file
94
20241118/kilenc/head.php
Normal file
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
session_start();
|
||||
$celkonyvtar = "kepek/";
|
||||
|
||||
function vizjel($celkonyvtar, $kepfajl){
|
||||
//eredeti kép másolata
|
||||
$img = imagecreatefromjpeg($kepfajl);
|
||||
|
||||
//vízjel szövegének a színbeállítása
|
||||
$wmcolor = imagecolorallocatealpha($img, 255,255,255, 25);
|
||||
|
||||
imagettftext($img, 50, 0,0,100,$wmcolor,'Vera.ttf', "WATERMARK");
|
||||
|
||||
// memóriában lévő kép lementése
|
||||
|
||||
imagejpeg($img, $celkonyvtar.'vízjeles.jpg', 75);
|
||||
|
||||
}
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"]=="POST")
|
||||
{
|
||||
if (!is_dir($celkonyvtar))
|
||||
{
|
||||
mkdir($celkonyvtar);
|
||||
}
|
||||
|
||||
$uname = uniqid();
|
||||
|
||||
|
||||
$celfajl = $celkonyvtar.$_FILES["kepfajl"]["name"];
|
||||
|
||||
$maxmeret = 5*1024*1024;
|
||||
$kepkiterjesztes = strtolower(pathinfo($celfajl,PATHINFO_EXTENSION));
|
||||
$uploadOK = 1;
|
||||
|
||||
if (getimagesize($_FILES["kepfajl"]["tmp_name"])===false)
|
||||
{
|
||||
$uploadOK = 0;
|
||||
echo "Nem kép lett megadva.";
|
||||
}
|
||||
|
||||
if ($_FILES["kepfajl"]["size"]>$maxmeret)
|
||||
{
|
||||
$uploadOK = 0;
|
||||
echo "Túl nagy állomány";
|
||||
}
|
||||
|
||||
if ($kepkiterjesztes!="jpg" && $kepkiterjesztes!="png")
|
||||
{
|
||||
$uploadOK = 0;
|
||||
echo "Nem megengedett képformátum";
|
||||
}
|
||||
|
||||
if ($uploadOK==1)
|
||||
{
|
||||
|
||||
$vanmar = 0;
|
||||
if (file_exists($celfajl))
|
||||
{
|
||||
$vanmar = 1;
|
||||
}
|
||||
|
||||
if (move_uploaded_file($_FILES["kepfajl"]["tmp_name"],$celfajl)==true)
|
||||
{
|
||||
if ($vanmar==0){
|
||||
$_SESSION["kepek"][] = $celfajl;
|
||||
|
||||
vizjel($celkonyvtar, $celfajl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Képek listázása tényleges állományok alapján
|
||||
$kepek = glob($celkonyvtar."*");
|
||||
|
||||
foreach ($kepek as $img)
|
||||
{
|
||||
echo '<img src="'.$img.'" style="width: 200px; height: auto;">';
|
||||
}
|
||||
|
||||
//Képek listázása feltöltés után SESSION-ből
|
||||
/*
|
||||
if (isset($_SESSION["kepek"]))
|
||||
{
|
||||
foreach ($_SESSION["kepek"] as $value)
|
||||
{
|
||||
echo '<img src="'.$value.'" style="width: 200px; height: auto;">';
|
||||
}
|
||||
}
|
||||
*/
|
||||
?>
|
24
20241118/kilenc/html.php
Normal file
24
20241118/kilenc/html.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
include("head.php");
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="hu">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Képek kezelése</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Képek feltöltése PHP-val</h1>
|
||||
<form action="#" method="POST" enctype="multipart/form-data">
|
||||
Név: <input type="text" name="kepnev"><br>
|
||||
<input type="file" name="kepfajl"><br>
|
||||
<button type="submit">Feltölt</button>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
20241118/kilenc/images/gyik.jpg
Normal file
BIN
20241118/kilenc/images/gyik.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
20241118/kilenc/images/orarend.jpg
Normal file
BIN
20241118/kilenc/images/orarend.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
BIN
20241118/kilenc/kepek/gyik.jpg
Normal file
BIN
20241118/kilenc/kepek/gyik.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
BIN
20241118/kilenc/kepek/langos.jpg
Normal file
BIN
20241118/kilenc/kepek/langos.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
BIN
20241118/kilenc/kepek/orarend.jpg
Normal file
BIN
20241118/kilenc/kepek/orarend.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
BIN
20241118/kilenc/kepek/vízjeles.jpg
Normal file
BIN
20241118/kilenc/kepek/vízjeles.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
41
20241118/obj.php
Normal file
41
20241118/obj.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
//objektumok használata
|
||||
|
||||
class Tanulo{
|
||||
public $nev;
|
||||
public $kor;
|
||||
public $jegyek = array();
|
||||
|
||||
public function __construct($nev, $kor){
|
||||
$this->kor = $kor;
|
||||
$this->nev = $nev;
|
||||
}
|
||||
|
||||
public function adjegy($jegy){
|
||||
$this->jegyek[] = $jegy;
|
||||
}
|
||||
|
||||
public function atlagkiszamit(){
|
||||
if (count($this->jegyek) == 0){
|
||||
return 0;
|
||||
} else{
|
||||
return array_sum($this->jegyek) / count($this->jegyek);
|
||||
}
|
||||
}
|
||||
|
||||
public function adatkiir(){
|
||||
$atlag = $this->atlagkiszamit();
|
||||
echo "Név: {$this->nev},\nKor: {$this->kor}, Átlag:"
|
||||
.number_format($atlag, 2);
|
||||
}
|
||||
}
|
||||
|
||||
$digi = new Tanulo("Szabó Márton", 19);
|
||||
$digi->adjegy(5);
|
||||
$digi->adjegy(2);
|
||||
$digi->adjegy(4);
|
||||
$digi->adjegy(5);
|
||||
$digi->adatkiir();
|
||||
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user