start of git dir

This commit is contained in:
2026-10-16 15:41:56 +03:00
commit c41e56d382
90 changed files with 5783 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
$file = 'kuva1.jpg';
list($old_width, $old_height) = getimagesize($file);
$max_width = 400;
if ($old_width > $max_width) {
$ratio = $old_width / $max_width;
$new_width = $max_width;
$new_height = (int) round($old_height / $ratio);
} else {
$new_width = $old_width;
$new_height = $old_height;
}
//echo "New dimensions: {$new_width} x {$new_height}";
$new_image = imagecreatetruecolor($new_width, $new_height);
$old_image = imagecreatefromjpeg($file);
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height);
// Tell the browser this script returns a JPEG image
header('Content-Type: image/jpeg');
// Output the image stream directly to the browser
imagejpeg($new_image, null, 90); // 90 = quality percentage (0-100)
imagedestroy($old_image);
imagedestroy($new_image);