--- On Tue, 1/26/10, David Bovill <[email protected]> wrote: > I've just dug out this very old and > pretty untested script for detecting > whether a file is an image. Seems to sort of work on OSX - > included here for > insiration :) Does anyone know a better way to do this? >
Why go through the trouble of checking the extension and the content of the file, when you can let Rev decide if it supports that particular file as a valid image? :-) Make a new stack with a button with the following script: ## on mouseUp answer file "Pick an image file" if the result is "Cancel" then exit mouseUp answer "Is a supported image format:" && IsAnImageFile(it) end mouseUp function IsAnImageFile pFilePath local tIsAnImageFile -- lock screen create image set the filename of the last image to pFilePath --> if the set fails, the result will tell you put (the result is empty) into tIsAnImageFile delete the last image return tIsAnImageFile end IsAnImageFile ## Click the button, select an image file, and it should be 'true' - select a Word document or something else that is definitely not an image, and yous should see 'false'. Cheers, Jan Schenkel ===== Quartam Reports & PDF Library for Revolution <http://www.quartam.com> ===== "As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld) _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
