Testing if an image is empty (blank)?
lists at mangomultimedia.com
Wed Aug 17 13:09:44 CDT 2005
On Aug 17, 2005, at 10:56 AM, Klaus Major wrote:
> Hi Trevor,
>> On Aug 16, 2005, at 11:26 AM, david bovill wrote:
>>> Thanks of the tip - works great for image object.
>>> On 16 Aug 2005, at 17:44, Derek Bump wrote:
>>>> if (the imagePixMapID of img "testImage") is empty then
>>>> answer "Unable to open the selected image." with "OK"
>>>> end if
>>> Now for the player object? Do you have any scripts / appleScripts
>>> for figuring out whether the fileType of a file is supported by
>>> QuickTime? I am getting rather pleasant / unpleasant surprises
>>> here - what is being displayed for pdf's and text files?
>>> Work in progress....
>> For images and player objects you can check the result() after
>> setting the fileName of the object. If it isn't empty then there
>> was an error.
> is this a "new" feature?
> I remember that with earlier versions the result was always empty,
> even if you selected
> a text (TXT) file.
Sorry, I need to clarify. If an error occurs while opening Rev tries
to open an image in an image object or any media in a player object
then result() will not be empty. When dealing with QuickTime, both
text and PDF (pdf on os x only) are acceptable media types so no
error is returned since there wasn't one.
You can use the EnhancedQT external AND the result() check for more
control. The function sqtCanOpenFile() AND qtGetMovieFileType() can
be used in the EnhancedQT external. qtCanOpenFile() can be set to
disregard TEXT files so it will report false will you pass a text
file to it. qtGetMovieFileType() will report the type, multiframe
graphic, image, unsupported, etc. PDF and GIF would be multiframe
graphic types. You still need to check the result() because QT
thinks it can open some MPEG files when it really can't. You can
check out the external at <http://mangomultimedia.com/developer/
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode