调整Amazon Cloud中jpg url的大小以适合我的Claris pro 19 Web门户

问题描述

我正在使用Claris Pro 19 我想从我们的亚马逊云中提取jpg,我有与之关联的URL,但是我无法将照片的大小调整为Filemaker Claris上的Web门户。这些照片硕大无比。 你能帮忙吗?。

解决方法

Filemaker不能实际调整图像的原始大小(除非您可以编写javascript或PHP函数并通过webviewer或从URL脚本步骤插入来调用它们)。

最好的方法是使用插件。 MonkeyBreadSoftware插件的示例如下:

#Allow user abort / Set error capture
#-
Set Error Capture [ On ]
Allow User Abort [ Off ]
#-
Set Variable [ $image; Value:Get ( ScriptParameter ) ]
#-
#Load image
Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; $image) ]
If [ MBS("Iserror") ]
    If [ Get ( LayoutName ) = "NarocilniceLineItems" ]
        Close Window [ Current Window ]
    End If
    Show Custom Dialog [ Message: "error” ]
    Exit Script [ ]
End If
#Scale?
Set Variable [ $ScaleWidth; Value:GetAsNumber(640) ]
Set Variable [ $ScaleHeight; Value:GetAsNumber(640) ]
Set Variable [ $DoScale; Value:0 ]
If [ $ScaleWidth > 0 ]
    If [ $ScaleHeight > 0 ]
        Set Variable [ $Scale; Value:GetAsText($ScaleWidth) & "x" & GetAsText($ScaleHeight)]
    Else
        Set Variable [ $Scale; Value:GetAsText($ScaleWidth)]
    End If
    Set Variable [ $r; Value:MBS( "GMImage.Scale"; $img; $Scale ) ]
End If
#Clear profiles
Set Variable [ $r; Value:MBS( "GMImage.SetICCColorProfile"; $img; "" ) ]
Set Variable [ $r; Value:MBS( "GMImage.Setprofile"; $img; "IPTC"; "" ) ]
Set Variable [ $r; Value:MBS( "GMImage.Setprofile"; $img; "ICM"; "" ) ]
#query size
Set Variable [ $dest_width; Value:MBS( "GMImage.GetWidth"; $img) ]
Set Variable [ $dest_height; Value:MBS( "GMImage.GetHeight"; $img) ]
#For JPEG make a copy without alpha channel
Set Variable [ $secondImage; Value:MBS( "GMImage.New"; $dest_width & "x" & $dest_height; "white" ) ]
#6 = RGB without alpha
Set Variable [ $r; Value:MBS( "GMImage.SetType"; $secondImage; 6 )]
Set Variable [ $r; Value:MBS( "GMImage.CompositeXY"; $secondImage; $img; 0; 0; 1 ) ]
#JPEG with RGB
#70% quality
Set Variable [ $r; Value:MBS( "GMImage.SetQuality"; $secondImage; 70 ) ]
Set Variable [ $final_image; Value:$secondImage ]
#Cleanup
Set Variable [ $r; Value:MBS("GMImage.Destroy"; $img) ]
Exit Script [ Result: $final_image ]

这是我与提到的插件一起使用以减少图像大小的脚本的打印示例。只要图像存储在容器中并作为参数传递到脚本中,它就应该起作用。 我希望这可以对您有所帮助。