调整亚马逊云的jpg url大小,以适应我的Claris pro 19门户网站



我使用的是Claris Pro 19我想从我们的亚马逊云中提取jpgs,我有与之关联的URL,但我在将照片调整到Filemaker Claris上的门户网站时遇到了问题。这些照片很大。你能帮忙吗。。

Filemaker实际上无法以本机方式调整图像大小(也就是说,除非您可以编写javascript或PHP函数,并通过webviewer或Insert from 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 ]

这是我在上面提到的插件中使用的一个脚本的打印样本,用于缩小图像的大小。只要图像存储在容器中并作为参数传递到脚本中,它就应该起作用。我希望这对你有所帮助。

最新更新