2 Replies Latest reply on Nov 4, 2008 3:35 PM by 630530

    ORDImage thumbnail generation


      I have a table PICTURES containing a column PICTUREREF of type ORDSYS.ORDImage where the actual picture data resides on the file system. Is it possible to generate a thumbnail from it and store it to the file system, holding a reference to it in the table under a column THUMBREF of type ORDSYS.ORDImage?

      All the examples I have reviewed so far deal only with local data pictures.

      Thanks in advance and best regards,
        • 1. Re: ORDImage thumbnail generation
          Yes this is possible, using multiple steps. For sample code you want to combine the export() example with the thumbnail creation.

          1. Create the thumbnail image initially as a local empty image (stored in the database)

          2. use the processCopy method to scale the FILE based image to the thumbnail image

          3. use the export method to write the thumbnail image out to a file on the file system.

          4. truncate the lob data in the thumbnail to free up the database space, you can use the trimSource() object method or a dbms_lob procedure
          eg. thumbImage.trimSource(ctx, 0); OR
          dbms_lob.trim(thumbImage.source.localdata, 0);

          5 change the source attributes of the thumbnail image to point to the file system image that you created in step 3. This will also implicitly call the clearlLocal() object method to indicate that the file is now stored outside the database - non-locally

          e.g thumbImage.setSource('FILE', 'IMAGEDIR', 'thumbnail.jpg');

          6. Finally update the thumbnail column in your table with this newly modified thumbnail image object.
          1 person found this helpful
          • 2. Re: ORDImage thumbnail generation
            Hi rabbot,

            thanks for your answer. While waiting for an answer I solved the problem with a solution that is very similar to the one you suggested! Thanks a lot anyway!
            In fact, I was hoping there exists a method that simplifies the task, but my performance tests show it's ok to do it this way.

            Best regards,