get asset properties on htl page with asset path without using backend service in crx - aem

I have an asset path, which contains an asset, which I want to display in the UI. I can display the image using the path. But I want to display asset properties like title and other metadata which are present in jcr:content under that asset path.
One way I'm aware of is to use backend service and adapt to the asset and fetch those properties and send it to html file. Is there any way I can directly fetch those details in html file itself without having to use backend service.
note: asset number can be very high, would it better to use the service itself.

It's best to use the (backend service) Asset APIs but you could also hack your way with just HTL if you know exactly the JCR node and property. data-sly-use allows specifying a JCR path to return the org.apache.sling.api.resource.Resource:
<sly data-sly-use.myImg="/content/dam/core-components-examples/library/adobe-logo.svg/jcr:content/metadata">${myImg.valueMap['dc:title']}</sly>

Example for asset title.
${item.metadata['dc:title']}

Related

AEM 6.4 asset renditions, is it safe to remove all the rendition

I have created a custom workflow model for DAM update asset. I have kept two steps only Metadata Processor and DAM Update Asset Workflow Completed
I am on 6.4 and I could see 319x319 rendition is used in content finder. Want to know if other renditions are used by any default AEM components? If used, is there any possibility to make all of them point to a single rendition?
You can safely remove all renditions, if, in fact, you do not use them at all and you display the raw image from your DAM (the only downside is that your Content Authors will lose several thumbnails, usually helpful to identify the asset they want to use). If you need image manipulation and optimization, you can review ACS Commons Named Transform Image Servlet or any other external service (Akamai, Adobe Dynamic Media).

Add custom metadata fields for DAM assets in a particular folder

I created custom metadata fields for DAM Assets in CQ 5.6.1 using the steps detailed here. However, as described in the document, these changed fields are available for ALL assets in the DAM.
I need these metadata fields to be made available to only a specific folder, say /content/dam/foo instead of every asset.
How can I achieve this?
In my knowledge, there is no straight forward way to achieve this but there is one trick to handle this.
AEM DAM has the notion of meta schema editors. These editors are tied to asset file type, meaning - jpeg, mov, etc. For an asset MIME type, you can define the meta data and its associated form.
AEM 6.0 provides choral UI interface to achieve this --
http://localhost:4502/libs/dam/gui/content/metadataschemaeditor/schemalist.html/dam/content/schemaeditors/forms
Am not aware of any such interface in AEM 5.6.1. The nodes tied to this are at /libs/dam/content/asseteditors/image/jpeg/formitems. You could overlay them at /apps to add the required metadata.
Coming to the question, the trick is to add the file type into your dam content hierarchy. Example - /content/dam/jpeg/foo, /content/dam/png/foo, etc. This way, you would get different metadata for different folders of the dam.
Adobe recommends this approach as AEM 6.0 introduced the concept of processing profiles which you could attach to folders. This way, your different file types could get different treatments.

How to load assets dynamicaly in Unity3D?

What is the proper way to load external assets in Unity3D Webplayer?
My example consists of an empty scene and a button. I have to load an external asset into the scene when user clicks a button. Than i should assign scripts etc, but the question is - i can create an empty object with script, but how to load an external asset into it?
External asset is the file stored on the remote PC, accessible by http or any other protocol.
Unity has the WWW class for accessing data from certain protocols, most notably http like you said above.
http://docs.unity3d.com/Documentation/ScriptReference/WWW.html
If the object returns successfully you can access the data it downloaded. You can access the raw bytes it downloaded and treat the data however you need. Alternatively, you can access it as text or a texture if that is applicable in your situation.
You can have a look at AssetBundles:
https://unity3d.com/fr/learn/tutorials/topics/best-practices/assetbundle-fundamentals
Once the bundle is stored somewhere remotely you can download it using WWW.LoadFromCacheOrDownload and then instantiate specific objects from it.

how to push component state changes to multiple different pages using icefaces

In my project i want to upload a image in one page(ie:in one view),after uploading the image event is generated and bean1 is executed.please provide a solution for updating the loaded image to another page(ie second view)in which i use GraphicImage component.how to refer second view components in bean1 without generating event from second view.
Is it possible to do ajax push using icefaces 1.8.2 as discussed above.
IceFaces uploads a file to a specific path, given by
{Application Root}/{Upload directory}/{Session ID}
The Upload Directory is specified in web.xml. The Session ID folder is optional, depending on whether you specified the "uniqueFolder" attribute in the tag. You can also set the upload path as an attribute in the tag.
You can store the file path in a String or in a session variable through actionListener for the inputFile.
To refer to this path String from Bean2 without using the backing bean, you can bind your components to "#{Bean1.pathString}". If you want to use the backing-bean, you can do:
((Bean1) geBean("Bean1")).getPathString()
but only if you extend from AbstractPageBean. Also, Bean1 should be session scoped for either case.

How to Intercept image load requests in WebView?

Is it possible to intercept image load requests in WebView before they are actually started and modify their URLs?
For example, I have
mWebView.loadUrl(myUrl);
In onLoadResources event I can see URLs, but I can't modify them?
The thing is I am working on application that loads html content from remote location. For some reason author excluded image path and in img src he just have file name. Existing iPhone application is using this html content and I assume the content is build the way that is the best for iPhone. So, I need somehow to figure how to alter these paths. For example, if I choose to download all images first, I would need to alter path and add file:///... in front of image.jpg name.
Thanks.
you can use onLoadResource although are not only images but any resource loaded like javascript and css