<?php require_once 'library/utility.php'; require_once 'library/database.php'; global $database; $id = array_get($_GET, 'id'); $width = array_get($_GET, 'width', ''); $height = array_get($_GET, 'height', ''); $format = $width . "x" . $height; // Validate the parameters $formats = array("480x"); if (!is_scalar($id) || !is_scalar($width) || !is_scalar($height)) { die; } if (!in_array($format, $formats)) { die; } $commentFile = $database->getCommentFileByID($id); if (!$commentFile) { die; } $picture = getCommentUploadImagePath($commentFile['uploadfile']); $cached_picture = getCommentUploadImagePath($commentFile['uploadfile'], $width, $height); if (file_exists($cached_picture)) { $image = $cached_picture; } elseif (!file_exists($picture)) { $image = getDefaultImagePath(); } else { $image = getImage($picture, $cached_picture, $width, $height); } serveImage($image);
function getGroupCommentUploadImageUrl($commentFile, $width = null, $height = null) { $image = "images/" . getCommentUploadImageRelativePath($commentFile['uploadfile'], $width, $height); if (!file_exists(getCommentUploadImagePath($commentFile['uploadfile'], $width, $height))) { $id = $commentFile['id']; $image = "get_group_comment_upload.php?id={$id}&width={$width}&height={$height}"; } return SITE_URL . $image; }