modules/Administration/SugarSpriteBuilder.php
\SpritePlacement
\SugarSpriteBuilder
Properties

$supportedTypeMap= 'array(
IMG_GIF => IMAGETYPE_GIF,
IMG_JPG => IMAGETYPE_JPEG,
IMG_PNG => IMAGETYPE_PNG,
)'
array(
IMG_GIF => IMAGETYPE_GIF,
IMG_JPG => IMAGETYPE_JPEG,
IMG_PNG => IMAGETYPE_PNG,
)Details- Type
- n/a
Methods

addDirectory(
\$name $name, \$dir $dir
)
:
voidaddDirectory
This function is used to create the spriteSrc array
| Name | Type | Description |
|---|---|---|
| $name | \$name | String value of the sprite name |
| $dir | \$dir | String value of the directory associated with the sprite entry |

createSprites(
)
:
\$resultcreateSprites
This is the public function to allow the sprites to be built.
| Type | Description |
|---|---|
| \$result | boolean value indicating whether or not sprites were created |

getFileInfo(
$dir, $file
)
:
arraygetFileInfo
This is a private helper function to return attributes about an image. If the width, height or type of the image file cannot be determined, then we do not process the file.
| Name | Type | Description |
|---|---|---|
| $dir | ||
| $file |
| Type | Description |
|---|---|
| array | of file info entries containing file information (x, y, type) if image type is supported |

getFileList(
\$dir $dir
)
:
voidgetFileList
This method processes files in a directory and adds them to the sprites array
| Name | Type | Description |
|---|---|---|
| $dir | \$dir | String value of the directory to scan for image files in |

initSpriteImg(
\w $w, \h $h
)
:
voidinitSpriteImg
| Name | Type | Description |
|---|---|---|
| $w | \w | int value representing width of sprite |
| $h | \h | int value representing height of sprite Private function to initialize creating the sprite canvas image |

loadImage(
\$dir $dir, \$file $file, \$type $type
)
:
voidloadImage
private function to load image resources
| Name | Type | Description |
|---|---|---|
| $dir | \$dir | String value of directory where image is located |
| $file | \$file | String value of file |
| $type | \$type | String value of the file type (IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG) |

loadSpritesConfig(
\$dir $dir
)
:
voidloadSpritesConfig
This function is used to load the sprites_config.php file. The sprites_config.php file may be used to add entries to the sprites_config member variable which may contain a list of array entries of files/directories to exclude from being included into the sprites image.
| Name | Type | Description |
|---|---|---|
| $dir | \$dir | String value of the directory containing the custom sprites_config.php file |

logMessage(
\$msg $msg
)
:
voidprivate logMessage
This is a private function used to log messages generated from this class. Depending on whether or not silentRun or fromSilentUpgrade is set to true/false then it will either output to screen or write to log file
| Name | Type | Description |
|---|---|---|
| $msg | \$msg | String value of message to log into file or echo into output buffer depending on the context |