diff --git a/app/Controllers/Api/Images/Stats.php b/app/Controllers/Api/Images/Stats.php new file mode 100644 index 0000000..deb9d64 --- /dev/null +++ b/app/Controllers/Api/Images/Stats.php @@ -0,0 +1,77 @@ + 0, + "23.06.2024" => 0, + "24.06.2024" => 0, + "25.06.2024" => 0, + "26.06.2024" => 0, + "27.06.2024" => 0, + "28.06.2024" => 0, + "29.06.2024" => 0, + "30.06.2024" => 0, + "01.07.2024" => 0, + "02.07.2024" => 0, + "03.07.2024" => 0, + "04.07.2024" => 0, + "05.07.2024" => 0, + "06.07.2024" => 0, + "07.07.2024" => 0, + "08.07.2024" => 0, + "09.07.2024" => 0, + "10.07.2024" => 0, + "11.07.2024" => 0, + "12.07.2024" => 0, + "13.07.2024" => 0, + "14.07.2024" => 0, + "15.07.2024" => 292, + "16.07.2024" => 292, + "17.07.2024" => 154, + "18.07.2024" => 892, + "19.07.2024" => 606, + "20.07.2024" => 0010, + "21.07.2024" => 0 + ]; + + $barWidth = 20; + $barSpacing = 10; + $maxBarHeight = $imageHeight - 110; + $maxValue = max($data); + + $x = 50; + foreach ($data as $date => $value) { + $barHeight = ($value / $maxValue) * $maxBarHeight; + $y = $imageHeight - 70 - $barHeight; + imagefilledrectangle($image, $x, $y, $x + $barWidth, $imageHeight - 70, $barColor); + imagettftext($image, 13, 0, $x + 2, $y - 10, $textColor, $_SERVER['DOCUMENT_ROOT'].'/static/TTCommons-Medium.ttf', $value); + imagettftext($image, 10, 90, $x + 15, $imageHeight - 0, $textColor, $_SERVER['DOCUMENT_ROOT'].'/static/TTCommons-Medium.ttf', $date); // Rotated date + $x += $barWidth + $barSpacing; + } + + imageline($image, 50, $imageHeight - 70, $imageWidth - 50, $imageHeight - 70, $axisColor); + imageline($image, 50, 50, 50, $imageHeight - 70, $axisColor); + + header('Content-Type: image/png'); + imagepng($image); + imagedestroy($image); + + } +} +?> diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index 8a8e7fe..7da966f 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -10,6 +10,7 @@ use \App\Controllers\Api\Images\{Upload}; use \App\Controllers\Api\Images\Rate as PhotoVote; use \App\Controllers\Api\Images\Compress as PhotoCompress; use \App\Controllers\Api\Images\CheckAll as PhotoCheckAll; +use \App\Controllers\Api\Images\Stats as PhotoStats; use \App\Controllers\Api\Images\Comments\Create as PhotoComment; use \App\Controllers\Api\Images\Comments\Load as PhotoCommentLoad; use \App\Controllers\Api\Images\Comments\Rate as PhotoCommentVote; @@ -55,6 +56,9 @@ class ApiController public static function checkallphotos() { return new PhotoCheckAll(); } + public static function photostats() { + return new PhotoStats(); + } } \ No newline at end of file diff --git a/app/Controllers/MainController.php b/app/Controllers/MainController.php index e0192f4..5aab448 100644 --- a/app/Controllers/MainController.php +++ b/app/Controllers/MainController.php @@ -62,6 +62,7 @@ class MainController } + public static function logout() { DB::query('DELETE FROM login_tokens WHERE token=:userid', array(':userid'=>$_COOKIE['NGALLERYSESS'])); diff --git a/app/Controllers/PhotoController.php b/app/Controllers/PhotoController.php index 6cbdc7a..453d2e5 100644 --- a/app/Controllers/PhotoController.php +++ b/app/Controllers/PhotoController.php @@ -13,6 +13,11 @@ class PhotoController { Page::set('Photo'); } + public static function photoext() + { + Page::set('PhotoExt'); + + } } \ No newline at end of file diff --git a/app/Core/Routes.php b/app/Core/Routes.php index ff6e2d0..95d4f1a 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -18,6 +18,7 @@ class Routes Router::get('/author/$id', 'ProfileController@i'); Router::post('/api/login', 'ApiController@login'); Router::post('/api/register', 'ApiController@register'); + Router::get('/api/photo/stats', 'ApiController@photostats'); Router::get('/about', 'MainController@about'); Router::get('/rules', 'MainController@rules'); Router::get('/rules/pub', 'MainController@publicationRules'); @@ -25,6 +26,7 @@ class Routes Router::get('/rules/video', 'MainController@videoRules'); Router::get('/update', 'MainController@update'); Router::get('/top30', 'MainController@top30'); + Router::get('/photoext', 'PhotoController@photoext'); diff --git a/static/TTCommons-Medium.ttf b/static/TTCommons-Medium.ttf new file mode 100644 index 0000000..730b1fa Binary files /dev/null and b/static/TTCommons-Medium.ttf differ diff --git a/views/pages/Photo.php b/views/pages/Photo.php index e0bc59e..f75169a 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -183,6 +183,9 @@ if ($photo->i('id') !== null) {
+ Информация об изображении+ ++ +
+ + + + Динамика просмотров по датам+ +
+
+ + + |
+ ||||||||||||
+ + + + | +||||||||||||
Главная Личный кабинет Форум Правила Редколлегия + Светлая тема + © Администрация ТрансФото и авторы материалов, 2002—2024
+
+
+ Использование фотографий и иных материалов, опубликованных на сайте, допускается только с разрешения их авторов. |
+
- - | - -