View file page/shop/screen.php

File size: 865B
<?php
session_name('SID') . session_start();
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/file_function.php");
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/data_filter.php");
include_once($_SERVER["DOCUMENT_ROOT"]."/inc/imageReSize.class.php");
$src = $_GET['src'] ?? false;
$filename = $_SERVER["DOCUMENT_ROOT"]."/files/".$src;
header("Content-type: image/png");
if (is_safePicture(['jpg', 'jpeg', 'png'], $filename)) {
    $image = new SimpleImage();
    $image->load($filename);
    $image->resize(80, 80);
    $image->output();
} else {
    $text = 'Error!';
    $img = imagecreate(80, 80);
    imagecolorallocate($img, 255, 255, 255);
    $color = imagecolorallocatealpha($img, random_int(50, 210), random_int(50, 210), random_int(50, 210), random_int(10, 30));
    imagestring($img, 5, 5, 3, $text, $color); 
    imagepng($img);
    imagedestroy($img); 
}
 ?>