diff --git a/DEAD_CODE.md b/DEAD_CODE.md index d67b06cd..8af3849b 100644 --- a/DEAD_CODE.md +++ b/DEAD_CODE.md @@ -15,6 +15,4 @@ When you edit a file listed here, either delete its dead block or re-confirm it is still unused and leave a note. | File | Symbol | Refs | Commented out | Notes | -|------|--------|------|---------------|-------| -| `src/Core/Util/ImageUtils.php` | `resize(string $rURL, int $rMaxW, int $rMaxH)` | 0 | 2026-09-13 | `resize.php?url=` in views is a separate public endpoint, not this method. | -| `src/Core/Util/ImageUtils.php` | `generateThumbnail(string $rImage, int $rType)` | 0 | 2026-09-13 | Also had a pre-existing unreachable 32×64 branch (type 5 matched earlier); the whole method is unused regardless. | +| ---- | ------ | ---- | ------------- | ----- | diff --git a/src/Core/Util/ImageUtils.php b/src/Core/Util/ImageUtils.php index cf824862..cb08960b 100644 --- a/src/Core/Util/ImageUtils.php +++ b/src/Core/Util/ImageUtils.php @@ -40,87 +40,6 @@ class ImageUtils { return $rURL; } - // /** - // * Return the URL of a cached resized image, or the validated original. - // * - // * @param string $rURL Source image URL. - // * @param int $rMaxW Max width. - // * @param int $rMaxH Max height. - // * @return string Public URL of the resized image, or the validated source. - // */ - // public static function resize(string $rURL, int $rMaxW, int $rMaxH) { - // list($rExtension) = explode('.', strtolower(pathinfo($rURL)['extension'])); - // $rImagePath = IMAGES_PATH . 'admin/' . md5($rURL) . '_' . $rMaxW . '_' . $rMaxH . '.' . $rExtension; - - // if (file_exists($rImagePath)) { - // $rServerInfo = ServerRepository::getAll()[SERVER_ID]; - // $rDomain = (empty($rServerInfo['domain_name']) ? $rServerInfo['server_ip'] : explode(',', $rServerInfo['domain_name'])[0]); - - // return $rServerInfo['server_protocol'] . '://' . $rDomain . ':' . $rServerInfo['request_port'] . '/images/admin/' . md5($rURL) . '_' . $rMaxW . '_' . $rMaxH . '.' . $rExtension; - // } - - // return self::validateURL($rURL); - // } - - // /** - // * Generate and cache a thumbnail sized for the given stream type. - // * - // * @param string $rImage Source image path/URL. - // * @param int $rType Stream type controlling target dimensions. - // * @return bool True if the thumbnail exists/was created, false otherwise. - // */ - // public static function generateThumbnail(string $rImage, int $rType) { - // if ($rType == 1 || $rType == 5 || $rType == 4) { - // $rMaxW = 96; - // $rMaxH = 32; - // } else { - // if ($rType == 2) { - // $rMaxW = 58; - // $rMaxH = 32; - // } else { - // if ($rType == 5) { - // $rMaxW = 32; - // $rMaxH = 64; - // } else { - // return false; - // } - // } - // } - // list($rExtension) = explode('.', strtolower(pathinfo($rImage)['extension'])); - // if (!in_array($rExtension, ['png', 'jpg', 'jpeg'])) { - // } else { - // $rImagePath = IMAGES_PATH . 'admin/' . md5($rImage) . '_' . $rMaxW . '_' . $rMaxH . '.' . $rExtension; - // if (file_exists($rImagePath)) { - // } else { - // if (self::isAbsoluteUrl($rImage)) { - // $rActURL = $rImage; - // } else { - // $rActURL = IMAGES_PATH . basename($rImage); - // } - // list($rWidth, $rHeight) = getimagesize($rActURL); - // $rImageSize = self::getImageSizeKeepAspectRatio($rWidth, $rHeight, $rMaxW, $rMaxH); - // if (!($rImageSize['width'] && $rImageSize['height'])) { - // } else { - // $rImageP = imagecreatetruecolor($rImageSize['width'], $rImageSize['height']); - // if ($rExtension == 'png') { - // $rImage = imagecreatefrompng($rActURL); - // } else { - // $rImage = imagecreatefromjpeg($rActURL); - // } - // imagealphablending($rImageP, false); - // imagesavealpha($rImageP, true); - // imagecopyresampled($rImageP, $rImage, 0, 0, 0, 0, $rImageSize['width'], $rImageSize['height'], $rWidth, $rHeight); - // imagepng($rImageP, $rImagePath); - // } - // } - // if (!file_exists($rImagePath)) { - // } else { - // return true; - // } - // } - // return false; - // } - /** * Download a remote image into the local image cache. *