java.lang.Object
io.github.yvasyliev.telegramforwarderbot.reddit.util.PhotoUtils

public class PhotoUtils extends Object
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 Details

    • PhotoUtils

      public PhotoUtils()
  • Method Details

    • getUrl

      public URL getUrl(Link.Metadata metadata, int maxPhotoDimensions)
      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.