Commit Graph

45 Commits

Author SHA1 Message Date
Mikael Nordfeldth
97812549b9 Unnecessarily spammy logs for getThumbnail()
When trying to create thumbnails for remote media that don't have the
filename field set, we got a lot of output in the debug log.
2015-01-26 01:16:28 +01:00
Mikael Nordfeldth
2a7d45c986 No need for ImageMagick to detected animated GIF 2015-01-25 22:45:25 +01:00
Mikael Nordfeldth
4dd6d7869e Maybe we can detect animated files in core 2015-01-25 22:11:46 +01:00
Mikael Nordfeldth
a9135080c3 barename wasn't used, let's rename it filename and use it 2015-01-25 02:27:02 +01:00
Mikael Nordfeldth
79824a3625 Could not update avatar due to Bad Thumbnail parameters 2014-06-17 12:48:10 +02:00
Mikael Nordfeldth
5a3d74d9a8 UseFileAsThumbnailException (helps support GIFs) 2014-06-17 12:15:11 +02:00
Mikael Nordfeldth
adf896bc12 Add support for plugins to resize images
This also adds an event hook to get more metadata of the ImageFile.
Such as if it's animated or so.
2014-06-05 13:29:36 +02:00
Mikael Nordfeldth
db90e2bb65 Apparently exif_read_data wasn't globally available. 2014-05-14 10:35:05 +02:00
Mikael Nordfeldth
ca67e848eb Only JPEG files (and TIFF, which we don't support) have EXIF 2014-05-12 14:45:23 +02:00
Mikael Nordfeldth
214a10ddec File_thumbnail fixes (run scripts/upgrade.php)
We're now capable of doing image rotation for thumbnails based on
EXIF orientation data. Also, thumbnails are tracked by filenames and
thus we can delete them from storage when we feel like it.
2014-05-12 14:33:41 +02:00
Mikael Nordfeldth
e526909bd8 File width and height is now properly set for File 2014-04-22 12:09:24 +02:00
Mikael Nordfeldth
5fbb668855 Be more precise in return array from image scaling 2014-04-21 22:31:13 +02:00
Mikael Nordfeldth
d59eb5e184 Dynamically generate thumbnails (see full text)
The File object now stores width and height of files that can
supply this kind of information. Formats which we can not read
natively in PHP do not currently benefit from this. However an
event hook will be introduced later.

The CreateFileImageThumbnail event is renamed to:
CreateFileImageThumbnailSource to clarify that the hooks should not
generate their own thumbnails but only the source image. Also it now
accepts File objects, not MediaFile objects.

The thumbnail generation is documented in the source code. For
developers, call 'getThumbnail' on a File object and hope for the best.

Default thumbnail sizes have increased to be more appealing.
2014-04-21 20:46:11 +02:00
Mikael Nordfeldth
06d4cecf7f MediaFile thumbnail event hooks + VideoThumbnails plugin
The exception thrown from MediaFile will be caught and simply result in
no thumbnail at all right now. In the future we might use a catch-all
and have a "cannot generate preview"-icon or something.

VideoThumbnails requires php5-ffmpeg and php5-gd.
2014-04-16 21:48:58 +02:00
Mikael Nordfeldth
00aa3fa734 ImageFile unlink function referenced bad path 2014-04-16 20:08:21 +02:00
Mikael Nordfeldth
b0dfc70a54 Properly unlink all old avatars when deleting/uploading a new
We're also now using $config['image']['jpegquality'] to determine the
quality setting for resized images.

To set Avatar max size, adjust $config['avatar']['maxsize']

The getAvatar call now throws exceptions too. Related changes applied.
Now let's move Profile->avatarUrl to the Avatar class!
2013-10-01 17:00:10 +02:00
Siebrand Mazeland
7db24c32d6 * fix some i18n and L10n issues
* update/add translator documentation
* remove superfluous whitespace
2011-01-29 00:33:13 +01:00
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