Author: Luffy (sy-records) Committer: GitHub (web-flow) Pusher: sy-records Date: 2026-11-30T10:46:02+08:00
Commit: https://github.com/php/web-php/commit/e7a40748786896027c318907be7d91b4f6cb2f2e Raw diff: https://github.com/php/web-php/commit/e7a40748786896027c318907be7d91b4f6cb2f2e.diff Fix image path error in getImage function (#2120) Changed paths: M bin/createNewsEntry Diff: diff --git a/bin/createNewsEntry b/bin/createNewsEntry index 937330218a..489efa720b 100755 --- a/bin/createNewsEntry +++ b/bin/createNewsEntry @@ -106,27 +106,27 @@ function getConfTime(): int { for(;;) { function getImage(): ?array { global $imageRestriction; + $imagePath = Entry::IMAGE_PATH_REL; fwrite(STDOUT, "Will a picture be accompanying this entry?(y/N) "); $yn = fgets(STDIN); - if (strtoupper($yn[0]) !== "Y") { return NULL; } for ($isValidImage = false; !$isValidImage;) { - fwrite(STDOUT, "Enter the image name (note: the image has to exist in './images/news'): "); + fwrite(STDOUT, "Enter the image name (note: the image has to exist in '{$imagePath}'): "); $path = basename(rtrim(fgets(STDIN))); - if (true === file_exists(Entry::PHPWEB . "/images/news/$path")) { + if (true === file_exists(Entry::IMAGE_PATH_ABS . "/$path")) { $isValidImage = true; if (extension_loaded('gd')) { break; } - $imageSizes = getimagesize("./images/news/$path"); + $imageSizes = getimagesize(Entry::IMAGE_PATH_ABS . "/$path"); if (($imageSizes[0] > $imageRestriction['width']) || ($imageSizes[1] > $imageRestriction['height'])) { fwrite(STDOUT, "Provided image has a higher size than recommended (" . implode(' by ', $imageRestriction) . "). Continue with this image?(y/N) ");
