diff --git a/lib/imagekitio/constants/supported_transformation.rb b/lib/imagekitio/constants/supported_transformation.rb index c8158b6..864cad9 100644 --- a/lib/imagekitio/constants/supported_transformation.rb +++ b/lib/imagekitio/constants/supported_transformation.rb @@ -18,6 +18,33 @@ module SupportedTransformation 'rotation': "rt", 'blur': "bl", 'named': "n", + 'overlay_image': "oi", + 'overlay_image_trim': "oit", + 'overlay_image_cropping': "oic", + 'overlay_image_quality': "oiq", + 'overlay_image_DPR': "oidpr", + 'overlay_image_border': "oib", + 'overlay_image_background': "oibg", + 'overlay_image_aspect_ratio': "oiar", + 'overlay_x': "ox", + 'overlay_y': "oy", + 'overlay_focus': "ofo", + 'overlay_height': "oh", + 'overlay_width': "ow", + 'overlay_text': "ot", + 'overlay_text_font_size': "ots", + 'overlay_text_font_family': "otf", + 'overlay_text_encoded': "ote", + 'overlay_text_color': "otc", + 'overlay_text_width': "otw", + 'overlay_text_background': "otbg", + 'overlay_text_padding': "otp", + 'overlay_text_inner_alignment': "otia", + 'overlay_text_transparency': "oa", + 'overlay_alpha': "oa", + 'overlay_radius': "or", + 'overlay_text_typography': "ott", + 'overlay_background': "obg", 'progressive': "pr", 'lossless': "lo", 'trim': "t", diff --git a/test/imagekit/url_test.rb b/test/imagekit/url_test.rb index 88b6051..e0163ba 100644 --- a/test/imagekit/url_test.rb +++ b/test/imagekit/url_test.rb @@ -158,6 +158,32 @@ rotation: 90, blur: 10, named: "some_name", + overlay_x: 35, + overlay_y: 35, + overlay_focus: "bottom", + overlay_height: 20, + overlay_width: 20, + overlay_image: "/folder/file.jpg", + overlay_image_trim: false, + overlay_image_aspect_ratio: "4:3", + overlay_image_background: "0F0F0F", + overlay_image_border: "10_0F0F0F", + overlay_image_DPR: 2, + overlay_image_quality: 50, + overlay_image_cropping: "force", + overlay_text: "two words", + overlay_text_font_size: 20, + overlay_text_font_family: "Open Sans", + overlay_text_color: "00FFFF", + overlay_text_transparency: 5, + overlay_text_typography: "b", + overlay_background: "00AAFF55", + overlay_text_encoded: "b3ZlcmxheSBtYWRlIGVhc3k%3D", + overlay_text_width: 50, + overlay_text_background: "00AAFF55", + overlay_text_padding: 40, + overlay_text_inner_alignment: "left", + overlay_radius: 10, progressive: true, lossless: true, trim: 5, @@ -176,7 +202,7 @@ },] } url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024,e-contrast-true,e-grayscale-true,e-shadow-bl-15_st-40_x-10_y-N5,e-gradient-from-red_to-white,orig-true,w-200,h-200/default-image.jpg") + expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,ox-35,oy-35,ofo-bottom,oh-20,ow-20,oi-folder@@file.jpg,oit-false,oiar-4:3,oibg-0F0F0F,oib-10_0F0F0F,oidpr-2,oiq-50,oic-force,ot-two words,ots-20,otf-Open Sans,otc-00FFFF,oa-5,ott-b,obg-00AAFF55,ote-b3ZlcmxheSBtYWRlIGVhc3k%3D,otw-50,otbg-00AAFF55,otp-40,otia-left,or-10,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024,e-contrast-true,e-grayscale-true,e-shadow-bl-15_st-40_x-10_y-N5,e-gradient-from-red_to-white,orig-true,w-200,h-200/default-image.jpg") end it "test_generate_url_with_chained_transformation" do