Multichannel publishing typically requires creation of images for each channel. You do not want to use the same image size and resolution in Print that you post to Twitter. This Smart Mover Tip helps automate creation of those required image “renditions”.
Important notice: This example and code is provided for reference only. It is provided "AS IS," without warranties of any kind. Feel free to use it as a basis to create your own implementation. Do not contact WoodWing Support with questions and issues about this sample. All questions and remarks must be posted in this thread.
In general, I am going to download the required image(s) along with its metadata, resample it using “sips” or “ImageMagick” and upload that new rendition back into the same Dossier as the original.
I called my Process “MakeImageRenditions” and my Process Folder located in my Base Path looks like this:
The Process itself includes 5 Tasks:
Task 1: Enterprise Download
I set my Destination folder to “NewFiles” and created a query that selected the desired Images. Include the “Native” and “MetaData Files”.
I used a special Status to find my required Images and if you do the same “Set Status to ‘Next’” to prevent the the image from being processed repeatedly.
After this Task runs, in the destination folder, you will have 2 files for each selected Image.
For example, if a downloaded Image is called “myPicture” you would have the files “myPicture.jpg” and “myPicture-metadata.xml”…. the latter including all the Enterprise metadata for that Image… including any Dossier relation information.
Task 2: Image File Processing (sips)
I used “sips” (Mac OSX only) but you could also use the equivalent “ImageMagick” Task… regardless, set the Source folder to the same “NewFiles” used in Task 1 above. Enter the appropriate “sips” command. In my case I just resized the image height to 500 and let “sips” proportionally set the width. I also renamed the resulting file to include “-500” in the name and place it in the Destination folder “Renditions”.
So if the original file was named “myPicture.jpg” then the new rendition will be called “myPicture-500.jpg”.
Task 3: XSL Transform:
When we upload the new rendition, we want to put it in the same Dossier as the original. So we need that Dossier’s ID… which we can get from the -metadata.xml file we downloaded in Task 1. Using the XSL Transform Task we create a “-metadata.xml override file” to apply that relation along with the Brand and Category when we upload the new Image in Task 5.
Set the Source to the same “NewFiles” folder from Task 1, and the Destination to the “Renditions” folder in Task 2, using the provided XSL template.
Once this Task runs, using the same example, you will have a file called “myPicture-metadata.xml” in the destination folder.
You can download the xsl template file from here.
Task 4: Rename Files:
For Mover to properly apply the “-metadata.xml override” in the next Task, it must be named the same as its “sibling”. So we need to add the “-500” into the name for all the override files in the “Renditions” folder. So “myPicture-metadata.xml” becomes “myPicture-500-metadata.xml”.
Task 5 Enterprise Upload
So now we just upload the new Images found in the “Renditions” folder to Enterprise. It does not matter which Brand or Category you select since the “-metadata.xml override” file is going to set those values to the same as the original Image. But you will need to select something for those popups just to make the UI error checking enable the OK button.
The “-metadata.xml override” not only sets each upload’s Brand and Category but it also creates the appropriate Dossier relation.
Please sign in to leave a comment.