Testing if an image is empty (blank)?

Klaus Major klaus at major-k.de
Wed Aug 17 14:56:45 EDT 2005


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?
>>>> ork 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/revolution/>

Go figure :-)

Sorry, i only meant images and thought that the result was empty in  
any case in
earlier version when you tried to set the filename of an image to  
e.g. a text file.

> Trevor DeVore
> Blue Mango Multimedia
> trevor at mangomultimedia.com

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list