ImageUtility
Image utility class for helping with image handling.
Method Summary
Public Methods | ||
public |
addRemainingDefaults(type: string, thumbnails: List): List Add remaining defaults to the list of thumbnails for editing purposes. |
|
public |
checkImageListValid(imagelist: List): Boolean Checks whether the image list is valid using an overly complex set of logical comparisons. |
|
public |
checkNumDefaults(type: string, num_defaults: Number, uploaded_images: List): Boolean Checks the number of defaults with the length of the uploaded images and the allowed number of images. |
|
public |
checkPhotosForDefaults(type: string, images: List): Boolean Checks if all the images are default images. |
|
public |
formThumbnail(thumbnails: List): List Forms the thumbnail into a useable list of objects. |
|
public |
getDefaultImage(type: string): string Returns the default image for a specific image type. |
|
public |
getDefaultPhotos(type: string): List Return the default photo entries. |
|
public |
Returns the defined file extension for images. |
|
public |
getPhotoEntries(type: string): Object Returns the photo entries. |
|
public |
getTypeConstant(type: string, index: Number): string/Number Returns the constant associated with a particular image type and index. |
|
public |
Returns the possible image types. |
|
public |
isAlreadyUploaded(image: string): Boolean Checks if an image has already been uploaded by checking if it contains the firebase url. |
|
public |
isDefaultImage(type: string, image: string): Boolean Checks if the image is the default image for an associated type. |
Public Methods
public addRemainingDefaults(type: string, thumbnails: List): List source
Add remaining defaults to the list of thumbnails for editing purposes.
Params:
Name | Type | Attribute | Description |
type | string | The type of image constant requested (e.g. BIKE, PROFILE, etc.) |
|
thumbnails | List | A list of thumbnails |
Return:
List | A list of thumbnails of length NUMBER_OF_BIKE_IMAGES with defaults |
public checkImageListValid(imagelist: List): Boolean source
Checks whether the image list is valid using an overly complex set of logical comparisons. Really not needed but all these cases came up and proved to be a problem.
Params:
Name | Type | Attribute | Description |
imagelist | List | A list of images to check |
public checkNumDefaults(type: string, num_defaults: Number, uploaded_images: List): Boolean source
Checks the number of defaults with the length of the uploaded images and the allowed number of images.
Return:
Boolean | true: If the number of defaults found is conversely related to the number of uploaded images based on the allowed number of images; false: otherwise |
public checkPhotosForDefaults(type: string, images: List): Boolean source
Checks if all the images are default images.
Params:
Name | Type | Attribute | Description |
type | string | The type of image constant requested (e.g. BIKE, PROFILE, etc.) |
|
images | List | A list of images |
public formThumbnail(thumbnails: List): List source
Forms the thumbnail into a useable list of objects.
Params:
Name | Type | Attribute | Description |
thumbnails | List | A list of thumbnails with links |
Return:
List | A list of thumbnail objects with an 'illustration' property |
public getDefaultImage(type: string): string source
Returns the default image for a specific image type.
Params:
Name | Type | Attribute | Description |
type | string | The type of image constant requested (e.g. BIKE, PROFILE, etc.) |
public getDefaultPhotos(type: string): List source
Return the default photo entries.
Params:
Name | Type | Attribute | Description |
type | string | The type of image constant requested (e.g. BIKE, PROFILE, etc.) |
Return:
List | A list of objects with the property 'illustration' that contains the uri |
public getPhotoEntries(type: string): Object source
Returns the photo entries.
Params:
Name | Type | Attribute | Description |
type | string | The type of image constant requested (e.g. BIKE, PROFILE, etc.) |
public getTypeConstant(type: string, index: Number): string/Number source
Returns the constant associated with a particular image type and index.
Return:
string/Number | The constant associated with the type and index |
public isAlreadyUploaded(image: string): Boolean source
Checks if an image has already been uploaded by checking if it contains the firebase url.
Params:
Name | Type | Attribute | Description |
image | string | An image url to check. Might be an object if image is trying to be uploaded |