Commit Graph

28 Commits

Author SHA1 Message Date
Brion Vibber
820dd293c9 Fix for ticket #3007: .bmp avatar uploads weren't being properly converted to PNG in all cases
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
2011-01-24 12:22:47 -08:00
Brion Vibber
dc497ed090 Break out ImageFile->resizeTo() from ImageFile->resize(); allows resizing images to non-square sizes and to arbitrary destinations. Will be used for creating thumbnails as well as the originala use of cropping/sizing avatars. 2010-11-08 16:56:08 -08:00
Siebrand Mazeland
83233a8a43 Fix i18n for B/kB/MB and add translator documentation. 2010-10-31 00:34:28 +02:00
Craig Andrews
9c5af9a38f Remove xpm support (no one really uses it, and IMAGETYPE_XPM is undefined, causing warnings)
Remove erroneous call to unlink in the constructor
2010-03-18 18:13:54 -04:00
Craig Andrews
d6e0640251 move image type checking to constructor, so checking will be done in all cases
check if the relevant image handling function exists when deciding if the image type is supported
2010-03-11 20:12:32 -05:00
Craig Andrews
d72c357750 add image support for xbm, xpm, wbmp, and bmp image formats 2010-02-24 22:24:11 -05:00
Siebrand Mazeland
c6b1ca3765 * Mb -> MB (for megabyte)
* i18n for MB and kB
2009-11-26 23:28:16 +01:00
Brion Vibber
088081675f Revert "Remove more contractions"
This reverts commit 5ab709b739.

Missed this one yesterday...
2009-11-09 20:01:46 +01:00
Siebrand Mazeland
5ab709b739 Remove more contractions
* doesn't
* won't
* isn't
* don't
2009-11-08 23:32:15 +01:00
Zach Copley
527427d3e0 Implement update avatar via API (/api/account/update_profile_image.format) 2009-11-04 21:00:26 -08:00
Brion Vibber
73b9e531bf Detect "no file" upload error and, for now at least, ignore it gracefully.
This was triggering on non-AJAX form submissions for new notices, preventing them from being posted when they contained no attachments.
2009-11-02 09:10:06 -08:00
Evan Prodromou
df86aa7214 define LACONICA and accept LACONICA for backwards compatibility 2009-08-26 10:41:36 -04:00
Evan Prodromou
865b716f09 change LACONICA to STATUSNET 2009-08-25 18:42:34 -04:00
Evan Prodromou
ae883ceb9b change controlyourself.ca to status.net 2009-08-25 18:19:04 -04:00
Evan Prodromou
d35b2d3f3c change laconi.ca to status.net 2009-08-25 18:16:46 -04:00
Evan Prodromou
c8b8f07af1 change Laconica and Control Yourself to StatusNet in PHP files 2009-08-25 18:12:20 -04:00
Zach Copley
b702461f69 fix bad function call (needed to be static) 2009-06-24 00:27:37 -07:00
Evan Prodromou
c1bc77efd9 whitespace and formatting 2009-02-09 12:06:06 -05:00
Sean Murphy
805560677b Fixed references to common_avatar_*. 2009-02-07 11:10:46 -05:00
Sean Murphy
a3d5e00f64 Merge commit 'upstream/0.7.x' into 0.7.x
Conflicts:

	actions/showstream.php
2009-02-07 11:02:10 -05:00
Sean Murphy
d900893149 Fixed #1152: Needless image scaling and poor JPG quality 2009-02-07 10:01:08 -05:00
Evan Prodromou
343cd6f205 Move common_avatar_* functions to Avatar
Moved the common_avatar_* functions to the Avatar class. Typically
either as methods on the object or as static methods. Replaced all the
uses of the functions in other modules.
2009-02-06 03:55:48 -05:00
Evan Prodromou
99d520b351 Two different functions for file size
Made two different functions for file size in ImageFile; one uses the
other.

Also, use sprintf() for gettext msgs.
2009-02-05 16:32:58 -05:00
Sean Murphy
d4bdb2dc19 Better fix for displaying max file size. 2009-02-05 15:01:44 -05:00
Sean Murphy
746a5d7507 Fixed #905: Presenting image size limit to user. 2009-02-05 14:11:50 -05:00
Sean Murphy
7e975b17c5 Fixed #1134; Consolidated image scaling functions. 2009-02-04 19:32:15 -05:00
Evan Prodromou
9dc5d8d0f6 Made avatar upload a two-stage process; first upload, then crop 2009-01-23 06:16:55 +01:00
Evan Prodromou
6a3204d08e Extract image management code to a helper function 2009-01-22 12:35:09 +01:00