Skip to content

Commit 84a3ec7

Browse files
authored
Merge pull request #414 from cloudinary/feature/add-shortened-ArtisticFilters
2 parents a2d0f99 + 1aacc58 commit 84a3ec7

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

__TESTS__/unit/actions/Effect.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ describe('Tests for Transformation Action -- Effect', () => {
152152
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/e_art:peacock/sample');
153153
});
154154

155+
it('Can use shortened artisticFilter notation', () => {
156+
const url = createNewImage('sample')
157+
.effect(Effect.artisticFilter("al_dente"))
158+
.toURL();
159+
160+
expect(url).toBe('https://res.cloudinary.com/demo/image/upload/e_art:al_dente/sample');
161+
});
162+
155163
it('Creates a cloudinaryURL with effect cartoonify:50', () => {
156164
const url = createNewImage('sample')
157165
.effect(cartoonify().lineStrength(50).blackwhite())

src/actions/effect.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {FadeInEffectAction} from "./effect/leveled/fadeIn";
2424
import {RemoveBackgroundAction} from "./effect/removeBackgroundAction";
2525
import {ThemeEffect} from "./effect/theme";
2626
import {SystemColors} from "../qualifiers/color";
27+
import {ArtisticFilterType} from "../types/types";
2728

2829

2930
/**
@@ -101,10 +102,10 @@ function oilPaint(oilPaintLevel?: number):EffectActionWithStrength {
101102
* @summary action
102103
* @description Applies an artistic filter to the asset.
103104
* @memberOf Actions.Effect
104-
* @param artisticFilterType
105+
* @param {ArtisticFilterType | string} artisticFilterType
105106
* @return {Actions.Effect.SimpleEffectAction}
106107
*/
107-
function artisticFilter(artisticFilterType: string):SimpleEffectAction {
108+
function artisticFilter(artisticFilterType: ArtisticFilterType | string):SimpleEffectAction {
108109
return new SimpleEffectAction('art', artisticFilterType);
109110
}
110111

src/types/types.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,29 @@ export type VideoFormatType =
284284

285285
export type AnimatedFormatType = "auto" | "gif" | "webp" | "png";
286286

287+
export type ArtisticFilterType =
288+
"al_dente"|
289+
"athena"|
290+
"audrey"|
291+
"aurora"|
292+
"daguerre"|
293+
"eucalyptus"|
294+
"hairspray"|
295+
"hokusai"|
296+
"peacock"|
297+
"primavera"|
298+
"quartz"|
299+
"incognito"|
300+
"red_rock"|
301+
"sizzle"|
302+
"fes"|
303+
"linen"|
304+
"refresh"|
305+
"sonnet"|
306+
"ukulele"|
307+
"frost"|
308+
"zorro";
309+
287310
export interface LegacyITransforamtionOptions {
288311
transformation?: LegacyITransforamtionOptions | string;
289312
raw_transformation?: string;

0 commit comments

Comments
 (0)