Last modified on 31 October 2012, at 12:42

REBOL Programming/load-image

USAGE:Edit

LOAD-IMAGE image-file /update /clear 

DESCRIPTION:Edit

Load an image through an in-memory image cache.

LOAD-IMAGE is a function value.

ARGUMENTS:Edit

  • image-file -- Local file or remote URL (Type: file url)

REFINEMENTS:Edit

  • /update -- Force update from source site
  • /clear -- Purge the entire cache

SOURCE CODEEdit

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
]