Quantcast
Channel: Adobe Community: Message List - Image optimization before original gets uploaded
Viewing all articles
Browse latest Browse all 4

Re: Image optimization before original gets uploaded

$
0
0

One thing to consider is not to intercept it but to add you code as one of the first steps in the update asset workflow. You would create a workflow process step and insert after probably the first step before the meta-data extraction step.

 

In your workflow process step you need to do a little JCR manipulation to update the original rendition node.

 

Once you have made your changes to the image you will want to convert it to an Input Stream.

 

Then you will need to get JCR Value Factory from the JCR Session

 

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/ValueFactory.html

 

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html

 

If you are doing this in a workflow process step you should be able to the get the session through either the resource of the DAM asset or the workflow session.

 

Once you have value factory you use it to create a new Binary object (http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Binary.html). Then get a new Value object from the value factory based on the binary object.

 

Once you have the value object you need to get the JCR Node for the original rendition (which you should already have if you were manipulating the file). You then get the child node named jcr:content and you set the jcr:data property to be the new Value object and save the session. That should replace the original binary and from that point on all the other DAM functionality should work. As intended.

 

You might want to consider copying the update asset workflow, making your changes and then changing the launcher configs to point to your workflow instead of the out of the box one just for clarity.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>