Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Image Croping

All examples are included with download of MBS FileMaker Plugin.

Image Croping.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts2
Value Lists0
Custom Functions0
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Image Croping
5 fields defined, 1 record
Image Croping

Fields

Table Name: Image Croping - 5 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputImageNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Global
  • Repetitions: 1
      SizeNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          ResultNormal, BinaryAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
              CommentNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  InfoNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German

                      Layout Objects: Image Croping

                      Regular Fields

                      Field Name: Image Croping::InputImage
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 65 pt
                      • Left: 122 pt
                      • Bottom: 358 pt
                      • Right: 537 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: System Default
                      • Go to next field using: Tab key
                      No

                      Field Name: Image Croping::Size
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 387 pt
                      • Left: 121 pt
                      • Bottom: 408 pt
                      • Right: 374 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: System Default
                      • Go to next field using: Tab key
                      Yes

                      Field Name: Image Croping::Result
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 437 pt
                      • Left: 121 pt
                      • Bottom: 742 pt
                      • Right: 536 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: System Default
                      • Go to next field using: Tab key
                      No

                      Field Name: Image Croping::Comment
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 411 pt
                      • Left: 121 pt
                      • Bottom: 432 pt
                      • Right: 374 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: System Default
                      • Go to next field using: Tab key
                      Yes

                      Field Name: Image Croping::Info
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 748 pt
                      • Left: 121 pt
                      • Bottom: 769 pt
                      • Right: 374 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: System Default
                      • Go to next field using: Tab key
                      Yes

                      Buttons

                      Button PropertiesCoordinatesScript/Script Step
                        Type:
                      • Text: Clear Images
                      • Top: 186 pt
                      • Left: 572 pt
                      • Bottom: 236 pt
                      • Right: 705 pt
                      • Anchoring: Left, Top
                      Perform Script [ “ClearImages” ]

                      Scripts:


                      Button PropertiesCoordinatesScript/Script Step
                        Type:
                      • Text: Crop Image
                      • Top: 442 pt
                      • Left: 583 pt
                      • Bottom: 476 pt
                      • Right: 692 pt
                      • Anchoring: Left, Top
                      Perform Script [ “Crop” ]

                      Scripts:


                      Button PropertiesCoordinatesScript/Script Step
                        Type:
                      • Text: Export Image
                      • Top: 482 pt
                      • Left: 583 pt
                      • Bottom: 516 pt
                      • Right: 692 pt
                      • Anchoring: Left, Top
                      Export Field Contents [ Image Croping::Result; Create directories:No ]

                      Fields:


                      Script Hierarchy

                      Crop
                      ClearImages

                      Next Script: [ClearImages]
                      Script NameCrop
                      Run script with full access privilegesOff
                      Include In MenuYes
                      Layouts that use this script
                      Scripts that use this script
                        Script Definition
                        Script Steps
                        • #Crop the picture by a given size
                        • #Load from container
                        • Set Variable [ $Image; Value:MBS("GMImage.NewFromContainer"; Image Croping::InputImage) ]
                        • #Crop image by the size
                        • Set Variable [ $r; Value:MBS("GMImage.Crop";$Image; Image Croping::Size) ]
                        • #In case of error
                        • If [ $r ≠ "OK" ]
                        • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                        • Set Field [ Image Croping::Info; $r ]
                        • Exit Script [ ]
                        • Else
                        • #Set the result
                        • Set Field [ Image Croping::Result; MBS("GMImage.WriteToPNGContainer"; $Image) ]
                        • Set Field [ Image Croping::Info; MBS("GMImage.GetWidth";$Image) & " x " & MBS("GMImage.GetHeight";$Image) ]
                        • Set Field [ Image Croping::Comment; "Crop "&MBS("GMImage.GetWidth";$Image) & " x " & MBS("GMImage.GetHeight";$Image) & " pixels from top left" ]
                        • End If
                        • #Release image
                        • Set Variable [ $r; Value: MBS("GMImage.Free";$Image) ]
                        Fields used in this script
                        Scripts used in this script
                          Layouts used in this script
                            Tables used in this script
                            Table occurrences used by this script
                            Custom Functions used by this script
                              Custom menu set used by this script

                                Previous Script: [Crop]
                                Script NameClearImages
                                Run script with full access privilegesOff
                                Include In MenuYes
                                Layouts that use this script
                                Scripts that use this script
                                  Script Definition
                                  Script Steps
                                  • #Delete the image that we want to crop
                                  • Go to Record/Request/Page [ First ]
                                  • Loop
                                  • Set Field [ Image Croping::Result; "" ]
                                  • Commit Records/Requests
                                  • Go to Record/Request/Page [ Next; Exit after last ]
                                  • End Loop
                                  Fields used in this script
                                  Scripts used in this script
                                    Layouts used in this script
                                      Tables used in this script
                                      Table occurrences used by this script
                                      Custom Functions used by this script
                                        Custom menu set used by this script

                                          Download example: Image Croping

                                          Used functions: