We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

  • Brion Vibber's avatar
    Fix for ticket #3007: .bmp avatar uploads weren't being properly converted to PNG in all cases · 820dd293
    Brion Vibber authored
    Part of the reported issue was previuosly fixed by dc497ed0 (smaller size images being blanked).
    This commit fixes the remaining bug with original-size avatars being left as BMP (which could include the 96px size for instance, which could cause problems in browsers not supporting BMP natively)
    Added ImageFile::copyTo() as a convenient alias for resizeTo() when not resizing; this performs the BMP/XPM/XBM->PNG conversion if needed, or copies the original file.
    Copying instead of using move_uploaded_file() is fine here since:
    a) the files are cleaned up on script completion anyway (vs moving to remove it)
    b) we're already performing getimagesize() and possibly load/resize on the file before this point (vs needing to move the file into a usable area to work with open_basedir restrictions that prevent working directly with uploaded files in the temp dir; since this would fail anyway, we lose nothing)
    ImageFile::preferredType() now works on $this->type instead of asking for one, to make it handier to use from outside. (This is still needed in order for calling code to generate a target filename.)
    Recommended for future:
    * additional consolidation between the various ways of uploading avatars (touched avatarsettings, grouplogo, and apiaccountupdateprofileimage with similar minor changes)
    * consolidate type checks and file naming into Avatar class
avatarsettings.php 16.1 KB