From 0a5a0e8616ceba369a1338da6e9ee248f310a099 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 27 Nov 2020 19:52:40 -0700 Subject: [PATCH 1/3] Add federated photo filters --- app/Http/Controllers/MediaController.php | 3 ++ app/Transformer/Api/MediaTransformer.php | 2 +- resources/assets/js/app.js | 43 +++++++++++++++++++ .../assets/js/components/ComposeModal.vue | 33 ++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/MediaController.php b/app/Http/Controllers/MediaController.php index 0f5c101a4..95c90396f 100644 --- a/app/Http/Controllers/MediaController.php +++ b/app/Http/Controllers/MediaController.php @@ -41,6 +41,9 @@ class MediaController extends Controller ->whereNull('status_id') ->findOrFail($id); + $media->version = 2; + $media->save(); + $fragments = explode('/', $media->media_path); $name = last($fragments); array_pop($fragments); diff --git a/app/Transformer/Api/MediaTransformer.php b/app/Transformer/Api/MediaTransformer.php index cca1e37c1..b1993e788 100644 --- a/app/Transformer/Api/MediaTransformer.php +++ b/app/Transformer/Api/MediaTransformer.php @@ -22,7 +22,7 @@ class MediaTransformer extends Fractal\TransformerAbstract 'is_nsfw' => $media->is_nsfw, 'orientation' => $media->orientation, 'filter_name' => $media->filter_name, - 'filter_class' => $media->filter_class, + 'filter_class' => $media->version == 1 ? $media->filter_class : null, 'mime' => $media->mime, ]; } diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index d368899e3..428843acc 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -139,6 +139,49 @@ window.App.util = { ['Willow','filter-willow'], ['X-Pro II','filter-xpro-ii'] ], + filterCss: { + 'filter-1977': 'sepia(.5) hue-rotate(-30deg) saturate(1.4)', + 'filter-aden': 'sepia(.2) brightness(1.15) saturate(1.4)', + 'filter-amaro': 'sepia(.35) contrast(1.1) brightness(1.2) saturate(1.3)', + 'filter-ashby': 'sepia(.5) contrast(1.2) saturate(1.8)', + 'filter-brannan': 'sepia(.4) contrast(1.25) brightness(1.1) saturate(.9) hue-rotate(-2deg)', + 'filter-brooklyn': 'sepia(.25) contrast(1.25) brightness(1.25) hue-rotate(5deg)', + 'filter-charmes': 'sepia(.25) contrast(1.25) brightness(1.25) saturate(1.35) hue-rotate(-5deg)', + 'filter-clarendon': 'sepia(.15) contrast(1.25) brightness(1.25) hue-rotate(5deg)', + 'filter-crema': 'sepia(.5) contrast(1.25) brightness(1.15) saturate(.9) hue-rotate(-2deg)', + 'filter-dogpatch': 'sepia(.35) saturate(1.1) contrast(1.5)', + 'filter-earlybird': 'sepia(.25) contrast(1.25) brightness(1.15) saturate(.9) hue-rotate(-5deg)', + 'filter-gingham': 'contrast(1.1) brightness(1.1)', + 'filter-ginza': 'sepia(.25) contrast(1.15) brightness(1.2) saturate(1.35) hue-rotate(-5deg)', + 'filter-hefe': 'sepia(.4) contrast(1.5) brightness(1.2) saturate(1.4) hue-rotate(-10deg)', + 'filter-helena': 'sepia(.5) contrast(1.05) brightness(1.05) saturate(1.35)', + 'filter-hudson': 'sepia(.25) contrast(1.2) brightness(1.2) saturate(1.05) hue-rotate(-15deg)', + 'filter-inkwell': 'brightness(1.25) contrast(.85) grayscale(1)', + 'filter-kelvin': 'sepia(.15) contrast(1.5) brightness(1.1) hue-rotate(-10deg)', + 'filter-juno': 'sepia(.35) contrast(1.15) brightness(1.15) saturate(1.8)', + 'filter-lark': 'sepia(.25) contrast(1.2) brightness(1.3) saturate(1.25)', + 'filter-lofi': 'saturate(1.1) contrast(1.5)', + 'filter-ludwig': 'sepia(.25) contrast(1.05) brightness(1.05) saturate(2)', + 'filter-maven': 'sepia(.35) contrast(1.05) brightness(1.05) saturate(1.75)', + 'filter-mayfair': 'contrast(1.1) brightness(1.15) saturate(1.1)', + 'filter-moon': 'brightness(1.4) contrast(.95) saturate(0) sepia(.35)', + 'filter-nashville': 'sepia(.25) contrast(1.5) brightness(.9) hue-rotate(-15deg)', + 'filter-perpetua': 'contrast(1.1) brightness(1.25) saturate(1.1)', + 'filter-poprocket': 'sepia(.15) brightness(1.2)', + 'filter-reyes': 'sepia(.75) contrast(.75) brightness(1.25) saturate(1.4)', + 'filter-rise': 'sepia(.25) contrast(1.25) brightness(1.2) saturate(.9)', + 'filter-sierra': 'sepia(.25) contrast(1.5) brightness(.9) hue-rotate(-15deg)', + 'filter-skyline': 'sepia(.15) contrast(1.25) brightness(1.25) saturate(1.2)', + 'filter-slumber': 'sepia(.35) contrast(1.25) saturate(1.25)', + 'filter-stinson': 'sepia(.35) contrast(1.25) brightness(1.1) saturate(1.25)', + 'filter-sutro': 'sepia(.4) contrast(1.2) brightness(.9) saturate(1.4) hue-rotate(-10deg)', + 'filter-toaster': 'sepia(.25) contrast(1.5) brightness(.95) hue-rotate(-15deg)', + 'filter-valencia': 'sepia(.25) contrast(1.1) brightness(1.1)', + 'filter-vesper': 'sepia(.35) contrast(1.15) brightness(1.2) saturate(1.3)', + 'filter-walden': 'sepia(.35) contrast(.8) brightness(1.25) saturate(1.4)', + 'filter-willow': 'brightness(1.2) contrast(.85) saturate(.05) sepia(.2)', + 'filter-xpro-ii': 'sepia(.45) contrast(1.25) brightness(1.75) saturate(1.3) hue-rotate(-5deg)' + }, emoji: ['๐Ÿ˜‚','๐Ÿ’ฏ','โค๏ธ','๐Ÿ™Œ','๐Ÿ‘','๐Ÿ‘Œ','๐Ÿ˜','๐Ÿ˜ฏ','๐Ÿ˜ข','๐Ÿ˜…','๐Ÿ˜','๐Ÿ™‚','๐Ÿ˜Ž','๐Ÿ˜€','๐Ÿคฃ','๐Ÿ˜ƒ','๐Ÿ˜„','๐Ÿ˜†','๐Ÿ˜‰','๐Ÿ˜Š','๐Ÿ˜‹','๐Ÿ˜˜','๐Ÿ˜—','๐Ÿ˜™','๐Ÿ˜š','๐Ÿค—','๐Ÿคฉ','๐Ÿค”','๐Ÿคจ','๐Ÿ˜','๐Ÿ˜‘','๐Ÿ˜ถ','๐Ÿ™„','๐Ÿ˜','๐Ÿ˜ฃ','๐Ÿ˜ฅ','๐Ÿ˜ฎ','๐Ÿค','๐Ÿ˜ช','๐Ÿ˜ซ','๐Ÿ˜ด','๐Ÿ˜Œ','๐Ÿ˜›','๐Ÿ˜œ','๐Ÿ˜','๐Ÿคค','๐Ÿ˜’','๐Ÿ˜“','๐Ÿ˜”','๐Ÿ˜•','๐Ÿ™ƒ','๐Ÿค‘','๐Ÿ˜ฒ','๐Ÿ™','๐Ÿ˜–','๐Ÿ˜ž','๐Ÿ˜Ÿ','๐Ÿ˜ค','๐Ÿ˜ญ','๐Ÿ˜ฆ','๐Ÿ˜ง','๐Ÿ˜จ','๐Ÿ˜ฉ','๐Ÿคฏ','๐Ÿ˜ฌ','๐Ÿ˜ฐ','๐Ÿ˜ฑ','๐Ÿ˜ณ','๐Ÿคช','๐Ÿ˜ต','๐Ÿ˜ก','๐Ÿ˜ ','๐Ÿคฌ','๐Ÿ˜ท','๐Ÿค’','๐Ÿค•','๐Ÿคข','๐Ÿคฎ','๐Ÿคง','๐Ÿ˜‡','๐Ÿค ','๐Ÿคก','๐Ÿคฅ','๐Ÿคซ','๐Ÿคญ','๐Ÿง','๐Ÿค“','๐Ÿ˜ˆ','๐Ÿ‘ฟ','๐Ÿ‘น','๐Ÿ‘บ','๐Ÿ’€','๐Ÿ‘ป','๐Ÿ‘ฝ','๐Ÿค–','๐Ÿ’ฉ','๐Ÿ˜บ','๐Ÿ˜ธ','๐Ÿ˜น','๐Ÿ˜ป','๐Ÿ˜ผ','๐Ÿ˜ฝ','๐Ÿ™€','๐Ÿ˜ฟ','๐Ÿ˜พ','๐Ÿคฒ','๐Ÿ‘','๐Ÿค','๐Ÿ‘','๐Ÿ‘Ž','๐Ÿ‘Š','โœŠ','๐Ÿค›','๐Ÿคœ','๐Ÿคž','โœŒ๏ธ','๐ŸคŸ','๐Ÿค˜','๐Ÿ‘ˆ','๐Ÿ‘‰','๐Ÿ‘†','๐Ÿ‘‡','โ˜๏ธ','โœ‹','๐Ÿคš','๐Ÿ–','๐Ÿ––','๐Ÿ‘‹','๐Ÿค™','๐Ÿ’ช','๐Ÿ–•','โœ๏ธ','๐Ÿ™','๐Ÿ’','๐Ÿ’„','๐Ÿ’‹','๐Ÿ‘„','๐Ÿ‘…','๐Ÿ‘‚','๐Ÿ‘ƒ','๐Ÿ‘ฃ','๐Ÿ‘','๐Ÿ‘€','๐Ÿง ','๐Ÿ—ฃ','๐Ÿ‘ค','๐Ÿ‘ฅ' ], embed: { diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index f934527c6..3a85aad87 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -1,6 +1,8 @@