This discussion is archived
2 Replies Latest reply: Nov 4, 2008 7:35 AM by 630530 RSS

ORDImage thumbnail generation

630530 Newbie
Currently Being Moderated

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
    251301 Explorer
    Currently Being Moderated
    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.
  • 2. Re: ORDImage thumbnail generation
    630530 Newbie
    Currently Being Moderated
    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,


  • Correct Answers - 10 points
  • Helpful Answers - 5 points