#-------------------------------------------------------------------------- # ScriptDisplayString.rb # This script is an example of user defined Display String generation. # The use the macro code %SF will call a function with the following # parameters: # - zAlb: a reference to the current album (an "Album" object), # - zPic: a reference to the current picture (a "Picture" object), # - zInfo: integer value (unused, reserved for future use). # The function returns a string containing the generated text. # Note: loading and executing a script function can be slow, this macro # should be used for Display Strings used for printing and HTML generation # rather than screen display. # This example computes the amount of megapixel the picture contains. # The %SF macro needs two parameters: the script file (use a complete path) # and the name of the function to call: # %SF["ScriptDisplayString.rb",MegaPixels] #-------------------------------------------------------------------------- MEGAPIX=1000000 # App.ClearTrace def MegaPixels( zAlb, zPic, zInfo ) #App.Trace ">> MegaPixels called !!!" if zPic == nil ">no pic !<" end nbPx = 100 * (zPic.w * zPic.h) / MEGAPIX nbPx = Float( nbPx ) / 100 "#{nbPx} Megapixel" end