0 Replies Latest reply on Jan 24, 2013 6:13 AM by JS Bournival

    Programmatically create thumbnail/renditions

    JS Bournival Level 1

      I'm trying to create a rendition of an image, on the fly, to avoid generating too much of them when uploaded.


      The thing seem to work OK until I reference the actual image rendition.


      1. I created an OSGi service that uses the appropriate AssetHandler to create the thumbnails


      AssetHandler assetHandler = assetStore.getAssetHandler(asset.getMimeType());


      2. then I create the thumbnails according to the provided config:


      assetHandler.createThumbnails(asset, configs);


      No exception is thrown.  Seemed to have worked OK.


      3. I make sure the rendition is created:


      for (Rendition rendition2 : asset.getRenditions()) {
           logger.info(rendition2.getName() + " " + rendition2.getPath());


      It is.  I'm almost happy.


      I use the newly created rendition's path in my JSP ... but I have a 404.  The image corresponding to the rendition haven't been written to the CRX repo.  I look in the CRX, and it's not there.


      What do I need to do to make the rendition persisted in the CRX?


      Thanks for any help!