Announcement

Collapse
No announcement yet.

Scaling an image in CRF Image viewer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scaling an image in CRF Image viewer

    Scaling an image in CRF Image viewer
    Here is a technique to auto scale an image to fit in the image viewer window when loading a record in data entry for which the image viewer is enabled. The images will fit the size of the image window.

    Setting up the Macro Library
    The easiest method is to put the code into a macro library at either the Global, Source or Study level. To add a macro library at the Source level:
    1. Go into System Administration / Sources.
    2. Select the libraries tab
    3. Add a row to the library table (Click the little Green +)
    4. Under Description, select Macro Library
    5. Choose a path and save the Source


    Copy Macro Code
    Once you have the macro library setup, copy the attached macro file SCALEIMG.SAS to the macro directory.

    Adding the macro calls to DE Screens
    Go into screen design and select the screen where you want the image to be scaled.
    1. Open the OnLoad Method entry
    2. Just after the comment block add the macro call as follows
      ** Call image scale macro **;
      %scaleimg;
    3. Save the screen


    Your onLoad method entry should look like this:
    Code:
    /** onLoad Method **/
    
    %include objfile;
    
    _onLoad: method _self_:u:object;
    link createobj;
    ************************;
    ** Add user code here **;
    ************************;
    
    ** Call image scale macro **;
    %scaleimg;
    
    endmethod;
    Attached Files
    Last edited by Ronni Rubenstein; 01-05-2007, 11:28 AM.

  • #2
    zoom in on image by n% automatically on load?

    Thanks, as usual, Greg.

    Can you comment on how to modify this code to automatically zoom in on the image by say 10% when it loads? We have a border of white space around all 4 edges of all of our images and are looking for a way to effectively ignore this whitespace when viewing the image in ClinPlus. In case it matters we have both portrait and landscape images.

    I look forward to your reply.



    Jason
    QST Consultations, Ltd.
    Last edited by jproos; 06-02-2006, 10:45 PM. Reason: typo

    Comment


    • #3
      Increase image size

      Jason,

      You can just increase the height and width values by 10% in the macro code.
      I added this code at line 28 of the macro just after I get the window height and width...

      Code:
         ** increase size 10% **;
         wwidth=wwidth*1.1;
         wheight=wheight*1.1;
      Regards
      Last edited by Greg Wagner; 06-05-2006, 10:08 AM.

      Comment

      Working...
      X