From 8a78d505500f641c0c34653c4971c3328dbf455c Mon Sep 17 00:00:00 2001 From: Daniel Neto Date: Mon, 16 Dec 2024 10:09:52 -0300 Subject: [PATCH] https://github.com/WWBN/AVideo/issues/9717 --- install/populateForTest.php | 119 +++++++++++------------ objects/functionInfiniteScroll.php | 6 +- objects/user.php | 1 + plugin/Gallery/view/BigVideo.php | 1 + plugin/YouPHPFlix2/view/modeFlixBody.php | 1 + view/channelBody.php | 9 +- 6 files changed, 73 insertions(+), 64 deletions(-) diff --git a/install/populateForTest.php b/install/populateForTest.php index fdc5ee352f13..56c456a6799f 100644 --- a/install/populateForTest.php +++ b/install/populateForTest.php @@ -17,11 +17,65 @@ $spritFile = 'assets/thumbsSprit.jpg'; $subtitleSRT = 'assets/subtitle.srt'; $subtitleVTT = 'assets/subtitle.vtt'; -$totalVideos = 50; -$totalPlaylists = 60; +$totalVideos = 400; +$totalPlaylists = 3; $totalVideosPerPlaylist = 30; $totalCategories = 10; $totalSubCategories = 5; + +function createImageWithText($text1, $text2, $filename) +{ + // Create a blank image + $width = 640; + $height = 360; + $image = imagecreatetruecolor($width, $height); + + // Allocate a color for the background and fill the background + $red = rand(0, 255); + $green = rand(0, 255); + $blue = rand(0, 255); + $backgroundColor = imagecolorallocate($image, $red, $green, $blue); + imagefilledrectangle($image, 0, 0, $width, $height, $backgroundColor); + + // Calculate the luminance of the background color + $luminance = (0.299 * $red + 0.587 * $green + 0.114 * $blue) / 255; + + // Allocate a color for the text + if ($luminance > 0.5) { + $textColor = imagecolorallocate($image, 0, 0, 0); // Use black text for a light background + } else { + $textColor = imagecolorallocate($image, 255, 255, 255); // Use white text for a dark background + } + + // Font size and path + $fontSize = 48; + $fontPath = 'assets/Arial.ttf'; + + // Calculate x position of the first line of text + $box1 = imagettfbbox($fontSize, 0, $fontPath, $text1); + $textWidth1 = $box1[2] - $box1[0]; + $x1 = ($width - $textWidth1) / 2; + + // Calculate x position of the second line of text + $box2 = imagettfbbox($fontSize, 0, $fontPath, $text2); + $textWidth2 = $box2[2] - $box2[0]; + $x2 = ($width - $textWidth2) / 2; + + // Y positions for each line of text + $y1 = ceil($height / 3); + $y2 = $y1 * 2; + + // Add the text to the image + imagettftext($image, $fontSize, 0, $x1, $y1, $textColor, $fontPath, $text1); + imagettftext($image, $fontSize, 0, $x2, $y2, $textColor, $fontPath, $text2); + + // Save the image + imagejpeg($image, $filename); + + // Free up memory + imagedestroy($image); +} + /* for ($i = 0; $i < $totalCategories; $i++) { $date = date('Y/m/d H:i:s'); @@ -43,7 +97,7 @@ echo "pupulating [$totalVideos/$i] subcategory saved [id=$id]" . PHP_EOL; } } - +*/ echo "pupulating ... "; $cats = Category::getAllCategories(); echo "pupulating ... ".__LINE__; @@ -58,7 +112,6 @@ $id = $video->save(false, true); echo "[{$total}/{$key}] pupulating video category saved [id=$id catId={$cats[$index]['id']}]" . PHP_EOL; } -exit; $newVideosIds = array(); @@ -103,7 +156,7 @@ $newVideosIds[] = $id; echo "pupulating [$totalVideos/$i] Video saved [id=$id]" . PHP_EOL; } - +/* AVideoPlugin::loadPlugin('PlayLists'); @@ -130,62 +183,8 @@ } } -die(); - -function createImageWithText($text1, $text2, $filename) -{ - // Create a blank image - $width = 640; - $height = 360; - $image = imagecreatetruecolor($width, $height); - - // Allocate a color for the background and fill the background - $red = rand(0, 255); - $green = rand(0, 255); - $blue = rand(0, 255); - $backgroundColor = imagecolorallocate($image, $red, $green, $blue); - imagefilledrectangle($image, 0, 0, $width, $height, $backgroundColor); - - // Calculate the luminance of the background color - $luminance = (0.299 * $red + 0.587 * $green + 0.114 * $blue) / 255; - - // Allocate a color for the text - if ($luminance > 0.5) { - $textColor = imagecolorallocate($image, 0, 0, 0); // Use black text for a light background - } else { - $textColor = imagecolorallocate($image, 255, 255, 255); // Use white text for a dark background - } - - // Font size and path - $fontSize = 48; - $fontPath = 'assets/Arial.ttf'; - - // Calculate x position of the first line of text - $box1 = imagettfbbox($fontSize, 0, $fontPath, $text1); - $textWidth1 = $box1[2] - $box1[0]; - $x1 = ($width - $textWidth1) / 2; - - // Calculate x position of the second line of text - $box2 = imagettfbbox($fontSize, 0, $fontPath, $text2); - $textWidth2 = $box2[2] - $box2[0]; - $x2 = ($width - $textWidth2) / 2; - - // Y positions for each line of text - $y1 = ceil($height / 3); - $y2 = $y1 * 2; - - // Add the text to the image - imagettftext($image, $fontSize, 0, $x1, $y1, $textColor, $fontPath, $text1); - imagettftext($image, $fontSize, 0, $x2, $y2, $textColor, $fontPath, $text2); - - // Save the image - imagejpeg($image, $filename); +//die(); - // Free up memory - imagedestroy($image); -} -*/ -/* AVideoPlugin::loadPlugin('PlayLists'); $pls = PlayList::getAll(); $videos = Video::getAllVideosLight(''); diff --git a/objects/functionInfiniteScroll.php b/objects/functionInfiniteScroll.php index deefdc0ab8ff..cc9385a6cde9 100644 --- a/objects/functionInfiniteScroll.php +++ b/objects/functionInfiniteScroll.php @@ -47,13 +47,15 @@ function getPagination($total, $link = "", $maxVisible = 10, $infinityScrollGetF { global $global, $advancedCustom; if ($total < 2) { - return ''; + return ''; } $page = getCurrentPage(); if ($total < $page) { $page = $total; } + + //var_dump($page, $total, getCurrentPage());exit; $isInfiniteScroll = !empty($infinityScrollGetFromSelector) && !empty($infinityScrollAppendIntoSelector); @@ -87,7 +89,7 @@ function getPagination($total, $link = "", $maxVisible = 10, $infinityScrollGetF . _getPageItem($link, $page, $uid, true) . ""; } - $pag = '