1 /* 2 * #%L 3 * wcm.io 4 * %% 5 * Copyright (C) 2021 wcm.io 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 package io.wcm.handler.mediasource.dam.impl.dynamicmedia; 21 22 import org.apache.sling.api.adapter.Adaptable; 23 import org.jetbrains.annotations.NotNull; 24 import org.jetbrains.annotations.Nullable; 25 26 import com.day.cq.dam.api.Asset; 27 28 import io.wcm.handler.media.Dimension; 29 import io.wcm.handler.url.UrlMode; 30 31 /** 32 * Read image profiles stored in /conf resources. 33 * Image profiles are usually stored at /conf/global/settings/dam/adminui-extension/imageprofile. 34 */ 35 public interface DynamicMediaSupportService { 36 37 /** 38 * @return Whether dynamic media is enabled on this AEM instance 39 */ 40 boolean isDynamicMediaEnabled(); 41 42 /** 43 * @param isDynamicMediaAsset true if given asset has DM metadata properties available. 44 * @return Whether dynamic media capability is enabled for the given asset 45 */ 46 boolean isDynamicMediaCapabilityEnabled(boolean isDynamicMediaAsset); 47 48 /** 49 * @return Whether a transparent fallback to Media Handler-based rendering of renditions is allowed 50 * if the appropriate Dynamic Media metadata is not preset for an asset. 51 */ 52 boolean isAemFallbackDisabled(); 53 54 /** 55 * @return Whether to validate that the renditions defined via smart cropping fulfill the requested image width/height 56 * to avoid upscaling or white borders. 57 */ 58 boolean isValidateSmartCropRenditionSizes(); 59 60 /** 61 * @return Reply image size limit as configured in dynamic media. 62 */ 63 @NotNull 64 Dimension getImageSizeLimit(); 65 66 /** 67 * Get image profile. 68 * @param profilePath Full profile path 69 * @return Profile or null if no profile found 70 */ 71 @Nullable 72 ImageProfile getImageProfile(@NotNull String profilePath); 73 74 /** 75 * Get image profile for given asset. 76 * @param asset DAM asset 77 * @return Profile or null if no profile found 78 */ 79 @Nullable 80 ImageProfile getImageProfileForAsset(@NotNull Asset asset); 81 82 /** 83 * Get scene7 host/URL prefix for publish environment. 84 * @param asset DAM asset 85 * @param urlMode URL mode 86 * @param adaptable Adaptable 87 * @return Protocol and hostname of scene7 host or null. 88 * If author preview mode is enabled, returns empty string. 89 */ 90 @Nullable 91 String getDynamicMediaServerUrl(@NotNull Asset asset, @Nullable UrlMode urlMode, @NotNull Adaptable adaptable); 92 93 }