Getting Started
  Introduction
  What is ImgWriter?
  Features and Benefits
  Requirements
 
Quick Start
  Edit an Existing Image
  Create a New Image
  Save an Image in a Database
  The Image Collection Object

Programmer's Reference
  Object Model
      SAImageGen
          ImageGen
          Font
      SAImageCollection
          Images
          Image

Installation
  Installing ImgWriter

External Links
  ImgWriter home page
  Technical Support
  ImgWriter live demos
  SoftArtisans Home Page
  E-mail General Questions
  E-mail Technical Support

Object Model ImageGen Font Images Image


Images

Use the Images collection object to cache images. To create an instance of Images, use,

Set objImages = Server.CreateObject("SoftArtisans.Images")
Images Methods
Images Properties
Images Methods
Exists

Takes an image name (see LoadImage), and returns True if the image is a member of the image collection or False if it is not.

Example:

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.LoadImage "House", "d:\images\house.jpg"
	If objImages.Exists("House") Then 
		Response.BinaryWrite objImages("House")
	End if
	Set objImages = Nothing
	


Go to: Top of page
LoadImage

Adds an image file to an Images collection. The new key must not exist in the collection. LoadImage can accept either a file or a byte array as an image source. LoadImage takes two arguments:

ImageNameVariable name for the loaded image. Use this name with SaveImage, Remove, and Exists.
ImageSourceThe complete path and file name of the image to add to the Images collection.

Examples:

Loading an image from a file:

Set objImages = Server.CreateObject("softartisans.images")
objImages.loadimage "Starry Night", "d:\images\starrynight.gif"

Loading an image from a byte array:

Dim byteArr
'--- If the first parameter of SaveImage is set to 1, the image 
'--- will be saved in memory.
byteArr = objImageGen.SaveImage(1,3,"d:\images\starrynight.gif")
objImages.LoadImage "img", byteArr
Go to: Top of page
Remove

Removes a specified image from the images collection. Remove takes the ImageName assigned by LoadImage.

Example:

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.LoadImage "Olive Trees", "d:\images\olivetrees.jpg"
	objImages.Remove "Evening"
	Set objImages = Nothing
	


Go to: Top of page
RemoveAll

Removes all images from the collection.

Example:

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.LoadImage "Olive Trees", "d:\images\olivetrees.jpg"
	objImages.RemoveAll
	Set objImages = Nothing
	


Go to: Top of page
SaveImage

Saves a specified image. Save image takes two arguments:

ImageNameImage name assigned by LoadImage.
ImageDestinationThe complete destination path and file name. Note: You must include a file name; if the file name is omitted, the original file name will not be used by default.

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "House", "d:\images\house.jpg"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.SaveImage "House", "d:\temp\house.jpg"	
	Set objImages = Nothing
	


Go to: Top of page


Images Properties
Count

Returns the number of images in the collection.

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.LoadImage "Olive Trees", "d:\images\olivetrees.jpg"
	Response.Write "The Images collection contains " & objImages.Count & " files."		
	Set objImages = Nothing
	


Go to: Top of page
Item

Represents a single image in an image collection. Item takes the image name assigned by LoadImage as a key. Item is the default property of Images, so Images("image") is equivalent to Images.Item("image").

Example:

	Set objImages = Server.CreateObject("SoftArtisans.Images")
	objImages.LoadImage "Starry Night", "d:\images\starrynight.gif"
	objImages.LoadImage "Evening", "d:\images\evening.jpg"
	objImages.LoadImage "Olive Trees", "d:\images\olivetrees.jpg"
	Response.BinaryWrite objImages("Evening")
	Set objImages = Nothing
	


Go to: Top of page


Object Model ImageGen Font Images Image


Copyright © 2001-2004, SoftArtisans, Inc.