Commit Graph

31 Commits

Author SHA1 Message Date
Diogo Peralta Cordeiro a681acae67
[ENTITY][AttachmentThumbnail] Every image should have width and height attributes 2021-09-25 19:40:11 +01:00
Diogo Peralta Cordeiro 3268559f9a
[AttachmentThumbnail] Use other thumbnail when requested isn't available and there's no original file 2021-09-23 16:19:50 +01:00
Diogo Peralta Cordeiro 4820a863a9
[Avatar] Fix cache usage and other minor bugs 2021-09-23 14:34:34 +01:00
Diogo Peralta Cordeiro 05f16a3084
[ENTITY][AttachmentThumbnail] Now thumbnails are always only available in three sizes: small, medium, big
Commit jointly produced with eli (Eliseu Amaro)

Breaking change: Entity changed to only store the tinyint referring to the size stored

With this, the logic was simplified and now it's not possible to make an
instance produce unnecessary thumbs. The aspect ratio is preserved and
thus the thumbs will always look nice. New configuration was added to
maintain flexibility.
2021-09-22 15:13:46 +01:00
Hugo Sales 4e30e5aad9
[TOOLS] Fix all issues found by PHPStan level 2 2021-09-14 13:13:44 +01:00
Diogo Peralta Cordeiro 2b457655ea
[CORE] Fix path configuration 2021-09-14 13:13:35 +01:00
Diogo Peralta Cordeiro f9079784c4
[ENTITY][AttachmentThumbnail] Improve the way EncoderPlugins participate in the thumbnail process 2021-09-14 13:13:35 +01:00
Hugo Sales 4cd3924cc1
[ATTACHMENTS][AttachmentThumbnail] Fix implementation of predictScalingValues and small fixes 2021-09-14 13:13:32 +01:00
Diogo Peralta Cordeiro f690bc06ae
[ATTACHMENT] Some attachments don't have thumbnails and that's okay 2021-09-14 13:13:27 +01:00
Diogo Peralta Cordeiro 3f61537140
[ENTITY] Split Attachment in various new entities
Remove Attachment Scope
Fixed some minor bugs

Scope will be implemented later in v3. It doesn't make sense to have
the scope handling being per attachment. Different actors can post
the same attachment with different scopes. The attachment controller
will assume the highest level of scope applied to the attachment and
the rest will be handled at the note level.

Motivation:
* Remove title from attachment, as it's part of the relation between attachment and note.
* Remove actor from attachment, many actors may publish the same attachment.
* Remove is_local from attachment,  as it's part of the relation between attachment and note.
* Remove remote_url from attachment, different urls can return the same attachment.

Addition:
* Attachment now has a lives attribute,  it's a reference counter with a nicer name
* GSActorToAttachment
* GSActorToRemoteURL
* RemoteURL
* RemoteURLToNote
* RemoteURLToAttachment
* AttachmentToNote now has a title attribute
2021-09-14 13:13:24 +01:00
Diogo Peralta Cordeiro 80cde06f4b
[MEDIA][Thumbnail] Fix non-instantiated variable 2021-09-14 13:13:04 +01:00
Diogo Peralta Cordeiro a5348f2427
[MEDIA][AttachmentThumbnail] Add mimetype to Entity 2021-09-14 13:13:04 +01:00
Diogo Peralta Cordeiro 861732176e
[Media] Support any kind of thumbnails in the Core
Sanitize Attachments instead of Validate (part 1)
Ensure the intended filetypes and mimetypes during Vips conversions (part 1)
Various bug fixes
2021-09-14 13:13:03 +01:00
Diogo Peralta Cordeiro 72dcff22f7
[MEDIA] We need permissions to run chmod in directories
It's better to have in the filename data that we couldnt't otherwise rapidly retrieve
2021-09-14 13:13:03 +01:00
Diogo Peralta Cordeiro 6ecdaa5d72
[MEDIA] Fix database misses on thumbnail retrieval
We were storing the real scaling values instead of the predictions, but the core is never able to pre-compute the real values generated by the encoding plugins so, we have to rely on our own aproximation function ported from v2
2021-09-14 13:13:03 +01:00
Diogo Peralta Cordeiro c8cf8c3f13
[FILE][TemporaryFile] Fix various issues now that we also have Symfony's file abstractions 2021-09-14 13:13:03 +01:00
Hugo Sales d31c3b1784
[AUTOGENERATED] Update autogenerated code 2021-09-14 13:13:01 +01:00
Hugo Sales 2b83a4b627
[UTILS][TemporaryFile] Change way TemporaryFile takes arguments and it's internal implementation 2021-09-14 13:12:58 +01:00
Diogo Peralta Cordeiro 4fcccb1d1c
[CORE][ImageEncoder] Add width and height back in attachment entity and allow for differently sized thumbs
The strategy adopted involves predicting the thumb size as we did in v2 before having vips resize
2021-09-14 13:12:56 +01:00
Hugo Sales e9b2b18093
[Avatar] Implement avatar deletion 2021-09-14 13:12:53 +01:00
Hugo Sales 30107de079
[Embed] Fix plugin. Only attempt to show an image, if we have one 2021-09-14 13:12:52 +01:00
Hugo Sales a7ef2babe6
[AUTOGENERATED] Update autogenerated code 2021-09-14 13:12:52 +01:00
Hugo Sales 9a7f1358c2
[ENTITY] Add utils to Attachment and AttachmentThumbnail to get the corresponding URL and html representation parameters 2021-09-14 13:12:51 +01:00
Hugo Sales d2bb5bba14
[ImageEncoder] Move DB::persist call to AttachmentThumbnail 2021-09-14 13:12:22 +01:00
Diogo Peralta Cordeiro 0eaccc32fe
[ATTACHMENTS] Further refactoring
Some key points:
- Components and Plugins shouldn't extend Module directly
- Avatars should be fetched via GSActor ID, not by nickname as that isn't unique
- Avatar now is a separate Component
- Common file utilities are now to be placed in Core\GSFile, this will
  handle storage and trigger validation
- Some bug fixes
2021-09-14 13:11:51 +01:00
Hugo Sales cdef6858ce
[ENTITY] Cache AttachmentThumbnail query result 2021-09-14 13:11:51 +01:00
Hugo Sales 65999bd183
[Poll] Move tables from core to plugin 2021-09-14 13:11:51 +01:00
Hugo Sales 716ca063d5
[ImageThumbnail] Finish image thumbnailing functionality 2021-09-14 13:11:51 +01:00
Hugo Sales 4358656c55
[ImageThumbnail] Implement image resizing with Intervention/Image 2021-09-14 13:11:50 +01:00
Hugo Sales 5579f4fa5d
[MEDIA] Rename File to Attachment 2021-09-14 13:11:50 +01:00
Diogo Peralta Cordeiro e7ed325ac6
[MEDIA] Refactor File as Attachment 2021-09-14 13:11:49 +01:00