Navigation

Search

resizeImage

Description

Resizes src_img proportionally to fit within max_width and max_height limits if it is too large.

Syntax

void resizeImage (resource $src_img, string $destName, int $src_width, int $src_height, int $max_width, int $max_height)



Parameter $src_img

Expected type: Resource
Description: An image created by one of the "imagecreatefrom" functions



Parameter $destName

Expected type: String
Description: The name of the "destination" file - avatar_{memberID}.jpeg or avatar_{memberID}.png depending on the avatar_download_png setting



Parameter $src_width

Expected type: Integer
Description: The width of the source image



Parameter $src_height

Expected type: Integer
Description: The height of the source image



Parameter $max_width

Expected type: Integer
Description: The maximum allowed width for the avatar



Parameter $max_height

Expected type: Integer
Description: The maximum allowed height for the avatar


Notes

  • If GD2 is present as detected in downloadAvatar(), it'll use it to achieve better quality.
  • Saves the new image to destination_filename.
  • Saves as a PNG or JPEG depending on the avatar_download_png setting.
View all versions of this function