downloadAvatar

Description

Downloads file from url and stores it locally for avatar use by ID_MEMBER.

Syntax

bool downloadAvatar (string $url, int $memID, int $max_width, int $max_height)



Parameter $url

Expected type: String
Description: The URL of the avatar to download



Parameter $memID

Expected type: Integer
Description: The ID of the member that this avatar belongs to



Parameter $max_width

Expected type: Integer
Description: The maximum width for the image



Parameter $max_height

Expected type: Integer
Description: The maximum height for the image



Return value

Expected type: Boolean
Description: Supports GIF, JPG, PNG, BMP and WBMP formats. Detects if GD2 is available. If GIF support isn't present in GD, handles GIFs with gif_loadFile() and gif_outputAsPng(). Uses resizeImage() to resize to max_width by max_height, if needed, and saves the result to a file. Updates the database info for the member's avatar. Returns whether the download and resize was successful.


Notes

  • Supports GIF, JPG, PNG, BMP and WBMP formats.
  • Detects if GD2 is available.
  • If GIF support isn't present in GD, handles GIFs with gif_loadFile() and gif_outputAsPng().
  • Uses resizeImage() to resize to max_width by max_height, if needed, and saves the result to a file.
  • Updates the database info for the member's avatar.
  • Returns whether the download and resize was successful.
Advertisement: