Commit Graph

111 Commits

Author SHA1 Message Date
Mikael Nordfeldth 67d09532dd Improved animated image thumbnail freedom of choice
Default is now to take still thumbnails of animated GIFs and then
show them as originals in an AttachmentListItem. The still frames
are mostly used with front-ends like qvitter.
2015-01-26 16:33:39 +01:00
Mikael Nordfeldth a8e613e508 Animated GIF restructuring, ImageMagick only used for resizing animated sequences. 2015-01-25 23:00:00 +01:00
Mikael Nordfeldth 2a7d45c986 No need for ImageMagick to detected animated GIF 2015-01-25 22:45:25 +01:00
Mikael Nordfeldth 97bf470895 File class improved debugging and filename generation
In some development code I noticed that when handling File objects without
filename values, there would be problems calling getPath and such.

The width and height value testing will be validated later anyway, and by
removing such a narrow test we can use events to generate thumbnails of
media formats supported by recently added plugins on demand.
2015-01-25 02:30:43 +01:00
Mikael Nordfeldth 3927acdde5 getUrl() fixed for File and File_thumbnail to correct http/https stuff and other 2015-01-12 19:22:10 +01:00
Mikael Nordfeldth cbb7ec07a5 When called in offline queue, File::url was HTTP
Despite having the site configured "always" for HTTPS, File generated
thumbnails and such with HTTP urls.
2015-01-12 19:19:41 +01:00
Hannes Mannerheim a3574bac6c we _do_ want to show text/html as attachments, since that's how mustard and crow expands oversized notices 2014-10-20 16:21:42 +02:00
Mikael Nordfeldth 1c04601a9c Removing excessive "inline" attachment listings 2014-08-05 11:30:45 +02:00
Mikael Nordfeldth 17b9614ff8 File->getEnclosure improvements (text/html is not an attachment) 2014-08-05 10:54:00 +02:00
Mikael Nordfeldth d16af504f6 File basename call lacked a dot 2014-06-22 17:05:11 +02:00
Mikael Nordfeldth 79824a3625 Could not update avatar due to Bad Thumbnail parameters 2014-06-17 12:48:10 +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 db443e9374 File::processNew now static and always throws exception on failure 2014-06-02 02:11:23 +02:00
Mikael Nordfeldth d6f52f5939 File::processNew can return -1 which was not true for empty()
Also, File->getEnclosure() now throws exception if not enough metadata.
2014-06-02 01:46:09 +02:00
Mikael Nordfeldth 2755e23707 Clear out stored files and reltaed thumbnails when a File is deleted. 2014-05-12 15:16:41 +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 a7a4eeef09 width and height are now properties in the File class 2014-05-07 09:51:37 +02:00
Mikael Nordfeldth 621533a7c2 Bad variable reference in event hook. 2014-05-06 23:40:45 +02:00
Mikael Nordfeldth 1776c90cb9 Moved oEmbed stuff out to a plugin (Oembed). 2014-05-06 23:32:13 +02:00
Mikael Nordfeldth cd6bd07c9d Handle File thumbnail errors better 2014-04-28 20:26:32 +02:00
Mikael Nordfeldth 37ce1f4766 Better fallback on UnsupportedMediaException 2014-04-28 12:12:06 +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 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 b3bf036975 Preparing File for dynamic thumbnail generation. 2014-04-21 12:33:26 +02:00
Mikael Nordfeldth 43a3f5ea90 File_oembed::saveNew are File::saveNew are static
Also did some non-backwards-compatible (to StatusNet) code cleanup.
2014-04-20 16:10:05 +02:00
Mikael Nordfeldth d3b4a8616d Original name preserved in uploaded file.
Avoiding collisions with date (shorter than before) and 4 character
random alphanumeric string. I bet someone could mass-upload files
and generate all combinations of aaaa-zzzz during the course of a
day, but then maybe that user should be disabled anyway :)
(filling the collision space will cause a never-ending loop).
2014-04-16 23:17:27 +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 639f1a01e0 File class no longer depends on MIME
+ minor tweaks to MediaFile
2014-03-08 03:51:47 +01:00
Jean Baptiste Favre 29f0922705 Add check after oembed API call. In case of error, returned value is false which generate error messages 'Trying to get property of non-object'. 2014-03-02 15:06:06 +01:00
Mikael Nordfeldth 73fe8a81b7 Slight cleanup in typing and syntax of File and File_* classes 2013-11-10 14:33:45 +01:00
Mikael Nordfeldth 48da97f204 MediaFile code improvements, preparing to implement multi-attachments
Maybe in the future we can use this for anonymous file uploads too?
With some kind of anonymous/pseudonymous profile. That'd be neat.
2013-10-05 18:47:45 +02:00
Mikael Nordfeldth b3e61ce7d0 Stronger typing, require array where param array 2013-08-29 10:27:39 +02:00
Mikael Nordfeldth 2a4dc77a63 The overloaded DB_DataObject function staticGet is now called getKV
I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV

   sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq)

If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV!

This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class)

Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
2013-08-18 13:13:56 +02:00
Mikael Nordfeldth 1a9a8ea730 staticGet for sub-Managed_DataObject classes now calls parent
The parent class for our database objects, Managed_DataObject, has a
dynamically assigned class in staticGet which objects get put into,
leaving us with less code to do the same thing.

We will probably have to move away from the DB_DataObject 'staticGet'
call as it is nowadays deprecated.
2013-08-12 19:46:44 +02:00
Siebrand Mazeland 2624afbcd4 Crazy gettext way to support two plurals in one string. 2011-12-28 12:44:42 +01:00
Evan Prodromou e3c010a870 try to check whether file exists over and over and over 2011-09-30 13:03:42 -04:00
Evan Prodromou 9ca3c3d1c3 move core schema to class files 2011-08-22 17:52:02 -04:00
Evan Prodromou 9a84907d17 Remove unused File::getAttachments() 2011-08-02 23:11:41 -04:00
Evan Prodromou 44bcc942b8 Break up stream code to use separate notice stream classes
Rearchitect (again!) notice stream code to delegate different functionality up and down the stack.

Now, different classes implement NoticeStream.
2011-03-24 18:04:19 -04:00
Evan Prodromou 0b35ce7c37 New NoticeStream class to reify streams of notices
We've been muddling through with 6- or 8-argument functions for managing streams. I'd
like to start thinking of streams as their own thing, and give them some more value.

So, the new NoticeStream class takes over the Notice::stream() function and Notice::getStreamByIds().

There's probably some fine-tuning to do on the object interface.
2011-03-23 11:29:55 -04:00
Brion Vibber b896a37da0 Use cachedQuery on File::getAttachments, plus other cleanups:
* dropped unnecessary join on notice table
* made the function actually static, since it makes no sense as an instance variable. The only caller (in AttachmentList) is updated.
2011-01-31 12:22:50 -08:00
Evan Prodromou d31397bd45 method to count notices linking to an URL 2010-12-28 13:44:49 -08:00
Evan Prodromou faf0081a8b Fixes from testing File::stream() 2010-12-28 12:57:31 -08:00
Evan Prodromou bf4c5cb41a Stream of notices linking to an URL 2010-12-28 11:58:55 -08:00
Brion Vibber e1ffbfed04 doc comments on File::processNew 2010-11-15 11:00:42 -08:00
Brion Vibber dbb95b76a4 Allow YouTube-style media links to be counted as enclosures for purposes of listing attachments/thumbs 2010-11-09 12:04:07 -08:00
Brion Vibber 6d7f02ff31 Pass file attachment thumbnails along with oEmbed data. 2010-11-08 17:22:01 -08:00
Brion Vibber a2994e3aa2 Testing... using photo info for temp thumbnails 2010-11-08 15:50:06 -08:00
Brion Vibber 883f7a6c0b Avoid marking files as attachments that are not locally uploaded, unless they're really oembedable. HTML-y things now excluded properly. 2010-11-08 13:27:54 -08:00
Siebrand Mazeland 6aeba0cb7c i18n/L10n updates. 2010-11-04 18:33:39 +01:00