Class PhotoUtils
java.lang.Object
io.github.yvasyliev.telegramforwarderbot.reddit.util.PhotoUtils
Utility class for handling photo URLs from Reddit links.
Provides methods to retrieve the appropriate URL based on the metadata and maximum photo dimensions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetUrl
(Link.Metadata metadata, int maxPhotoDimensions) Retrieves the URL for a photo based on the provided metadata and maximum dimensions.
-
Constructor Details
-
PhotoUtils
public PhotoUtils()
-
-
Method Details
-
getUrl
Retrieves the URL for a photo based on the provided metadata and maximum dimensions.If the combined width and height of the source resolution exceeds the maximum dimensions, it selects the largest available resolution.
- Parameters:
metadata
- The link metadata containing photo resolutions.maxPhotoDimensions
- The maximum allowed dimensions for the photo.- Returns:
- The URL of the selected photo resolution.
-