< Rebol Programming
USAGE:
LOAD-IMAGE image-file /update /clear
DESCRIPTION:
Load an image through an in-memory image cache.
LOAD-IMAGE is a function value.
ARGUMENTS:
- image-file -- Local file or remote URL (Type: file url)
REFINEMENTS:
- /update -- Force update from source site
- /clear -- Purge the entire cache
SOURCE CODE
load-image: func [
"Load an image through an in-memory image cache."
image-file [file! url!] "Local file or remote URL"
/update "Force update from source site"
/clear "Purge the entire cache"
/local image image-cache
][
image-cache: []
if clear [system/words/clear image-cache recycle]
if any [update not image: select image-cache image-file] [
if all [update image] [remove/part find image-cache image-file 2]
repend image-cache [
image-file
image: either file? image-file [load image-file] [
either update [load-thru/binary/update image-file] [load-thru/binary image-file]
]
]
]
image
]
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.