[Gambas-user] How can I flush the image cache?

Benoît Minisini gambas at ...1...
Mon Apr 16 12:57:31 CEST 2012


Le 16/04/2012 12:36, M. Cs. a écrit :
> There you are!
> It requires Imagemagick to be installed.
> There are possible downsides of the Picture.Load(mypicture):
> - If the image mypicture is broken or 0 sized, the program will fail
> to load, and crash.
> - The 'convert' of Imagemagick sometimes creates broken thumbnails, so
> I had to build in a size check with Stat(mypicture).Size.
>
> Csaba
>

OK I see. So the behaviour is normal: Picture[] is really an image cache 
that loads a specific path once.

To flush it entirely, you must call Picture.Flush() (hard to guess, 
isn't it?). Or you can assign a specific key: Picture[path] = ...

And yes, Picture.Load() will raise an error if it cannot load an image. 
But it should not crash the interpreter.

Regards,

-- 
Benoît Minisini




More information about the User mailing list