How AEM DAM Asset renditions are getting used in AEM? - aem

I know that while uploading any Image/Asset into AEM DAM will create the renditions, but am wondering that how these renditions are going to be used?
Generally when doing content authoring we will be pointing to the DAM asset paths only, but never saw using particular renditions paths of the image. can anyone help me to give an example for using this renditions.?

The most common use case it to have "responsive" images by making use of the picture element (requires polyfills like picturefill.js when used with IE).
Here's an example taken from the Adobe documentation on Adaptive images:
<div data-picture>
<div data-src='/content/dam/geometrixx-media/articles/meridien.png'></div>
<div data-src='/content/dam/geometrixx-media/articles/meridien.png/jcr:content/renditions/cq5dam.thumbnail.319.319.png' data-media="(min-width: 769px)"></div>
<div data-src='/content/dam/geometrixx-media/articles/meridien.png/jcr:content/renditions/cq5dam.thumbnail.140.100.png' data-media="(min-width: 481px)"></div>
</div>
As a result, the appropriate image will be rendered for the viewport breakpoints defined in data-media.

You can also consider using Named Transform Image Servlet that comes with acs-aem-commons package. It is handy to control many aspects of the image dynamically using just the image URL.
https://adobe-consulting-services.github.io/acs-aem-commons/features/named-image-transform/index.html

Related

I want to create Photo Filters by Javascript

Before upload a photo to my server I want to modify background, layout,.. of image like as Photo Filter of Instagram (please review attach image).
Please help me about that, jQuery plugin or Library to do it?
For styling images, you should mostly use CSS. There are pretty good CSS libraries out there for this. for example Instagram.css
<link rel="stylesheet" href="instagram.min.css">
Add a class filter-[filter-name] from list of possible classes:
<figure class="filter-[filter-name]">
<img src="assets/img/instagram.jpg">
</figure>
Results:
You can then use javascript or jQuery to dynamically add classes and apply filters.
I think this is solution for your problem
https://www.html5rocks.com/en/tutorials/canvas/imagefilters/#toc-conclusion
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

Script tags in RTE AEM 6.1

I am trying to create a Editor component that will take inline javascript.
I understand that I can use clientlibs folder for loading JS, but some of the video CDN folks require you to put embed tags with JavaScript in the editor, and I think some of that is also used for rapid development. Currently with the state of RTE, I cannot put a script <script/> tag even after extending it, as it strips it out and only takes the html tags.
Could you please provide any insight if this could be doable in AEM 6.1
Here's what I have tried:
I looked at several post didn't got a clue
extended RTE using Adobe's documentation, but see a script button, that only takes html tags.
looked for hacks that could tell me what part of the code is tripping out </script> tags or could not execute js.
looked for some components out there that does that, found nothing
so far.

Sightly and cq:dropTargets

I'm developing a new site using the latest AEM6 (formerly CQ). Originally you were able to drag images/videos into the components drop zone which was setup in the components dropTarget using JSP's.
But since Sightly templating is now the preferred way of building components rather than JSP's is it still possible to have dropTarget in Sighlty templates?
Drop target is configured using node cq:dropTargets node under the cq:editConfig and it doesn't depend on the used markup language.
The only thing that markup has to produce is a <div> tag with class cq-dd-CONFIGNAME which will be used as a drop zone. Sightly can easily generate such markup (below example will show it only in the edit mode):
<div data-sly-test="${wcmmode.edit}" class="cq-dd-images">Drop image here</div>

GitHub pages generator removing <video> tag

Context
I usually set up quick GitHub pages to document a few developments I do. They are usually very simple pages, which I generate from the repo settings using the Page Generator. I want to continue using this method, as moving to proper gh-pages with jekyll is too much of an overhead for something so simple.
Recently I came across a use case, where adding a simple 2 min video to the first section made a lot of sense. Not knowing any native markdown for HTML video I've decided to add the HTML code directly as I do in a lot of other situations:
<video width="640" height="400" controls preload>
<source src="https://github.my.company.com/Org/sample/blob/master/intro.mp4?raw=true"></source>
</video>
Problem
When I generate the page the tag is not there, which normally happens when the video tag is not supported. If I open the chrome console and edit the HTML directly, as expected, the video shows fine and I can play it, etc.
I can only assume that GitHub markdown engine, is removing the video tag because the context in which is running does not support video (headless, non-compatible agent, whatnot).
Since GitHub says it supports native HTML into page rendering, there's no specific markdown to say "DO NOT PARSE THIS AT ALL COSTS", leaving me without many options left.
Question
Has anyone come across this issue, and do you know if it's possible to have a video tag in a generated page without moving on to Jekyll?
As a quick solution to encounter this issue: you can convert your video into gif using any converter then insert it in your markdown ex:
## Website Overview
![alt_text](path_to_the_.gif)
You can delegate all the heavy job to a video hosting service.
Advantages are :
they do all the html video / flash fallback for you
they can serve proper encoding / bandwith depending on device / network
they have specialized CDN that ensure good delivery (? depends on carrier but
you cannot know)
Everybody in the industry delegates the pain of video management.
And the only code you have to add is something like this :
<iframe width="420" height="315" src="//www.youtube.com/embed/KgLfpnPdqZw" frameborder="0" allowfullscreen></iframe>

Use own tags instead of divs

I working on a web app. Is it good to use own html tags than divs? I mean using own tags instead of classes. This will make it easier to bind up dynamic content by splitting up common classes with id.
Example
<div id="message">
My Message
</div>
Replace with this
<message>
My message
</message>
I don't understand why you want this, because now HTML5 supports a lot of semantic tags like <audio>, <address>, etc. Usually, you can achive block-effect (i.e. combining or grouping related content in a block) by <div class="myblock"></div> for special purposes. Anyway, as you've asked, then for your information—you can use custom tags in HTML. Also you can style those using CSS and can use selectors to perform operation on those using JavaScript.
Note: Prior IE9 versions don't support custom tags. Hence you should create your tags like this using JavaScript:
<script type="text/javascript">
document.createElement('mytag');
</script>
The main practical reason for not doing this is that IE 8 and older do not let you style your custom tags. As Vishal mentions, there’s a workaround to this, but it does not work when JavaScript is disabled. And as he points out, you can use the class attribute—you should use id only for uniquely identifying a single element.
You can also use class attributes for elements other than div. You can first select an element so that its default (non-CSS) rendering is the best possible (among available alternatives), then add a class attribute.
In CSS, you would then normally use a class selector without tag name, e.g. .message (if you use class=message).