Nicolaus Busch Posted December 5, 2011 Posted December 5, 2011 Hi forum I'm using this function to generate a thumbnail: ImageThumbFromURL( Substitute( $Pfad ; "\\"; "\\\\"); 140 ) This works perfectly well no matter whether $Pfad is a URL or a local path in Windows runtimes, in Filemaker Advanced on Windows an on Mac 10.6 and 10.7 The same code executed in a runtime on Mac generates nothing but the text "ERROR" in the thumbnail field. The plugin ist loaded and visible in the list of plugins. Any ideas?
wbasham Posted December 5, 2011 Posted December 5, 2011 Is this a module you wrote yourself? If you can reproduce the error and send us a bug report we can take a look and see if we can identify the issue.
Nicolaus Busch Posted December 5, 2011 Author Posted December 5, 2011 Hi Brent I try to produce the report on the mac tomorrow. The function I use is this, I found it somewhere in the forums: RegisterGroovy( "ImageThumbFromURL( url ; maxpixels )" ; "import javax.imageio.ImageIO¶ import java.awt.image.BufferedImage¶ import java.awt.geom.AffineTransform¶ import java.awt.image.AffineTransformOp¶ ¶ BufferedImage img¶ ¶ if (url.indexOf("://") != -1) {¶ img = ImageIO.read(new URL(url))¶ } else {¶ img = ImageIO.read(new File(url))¶ }¶ ¶ Integer maxWH = img.getWidth()¶ if (img.getHeight() > maxWH){¶ maxWH = img.getHeight()¶ }¶ ¶ ¶ Double thumbscale = Double.parseDouble(maxpixels) / maxWH ¶ ¶ AffineTransform transform = AffineTransform.getScaleInstance(thumbscale, thumbscale)¶ ¶ AffineTransformOp op = new AffineTransformOp(transform,null)¶ BufferedImage scaledImage = op.filter(img, null)¶ return scaledImage" )
andries Posted December 6, 2011 Posted December 6, 2011 "ERROR" means Java throws an exception. WIth the function SMLastError you can get more details about this exception. Just put a "Show Custom Dialog" script step after your function call that shows SMLastError.
Nicolaus Busch Posted December 6, 2011 Author Posted December 6, 2011 WIth the function SMLastError you can get more details about this exception. Just put a "Show Custom Dialog" script step after your function call that shows SMLastError. I made a mistake here, it doesnt work with the full version either. SMLastError is "javax.imageio.IIOException: can't read input file" with $Path reading like "MacDisk:library:test.jpg". I guess I have to transforme the path first?
Nicolaus Busch Posted December 6, 2011 Author Posted December 6, 2011 Problem solved, with a path like /Volumes/MacDisk/Library/test.jpg everything is fine
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now