Skip to content

Add support for Random.image #2

@DanBurkhardt

Description

@DanBurkhardt

Add support for:

  • Image API datasource, potentially supporting multiple types of image APIs
  • Random.image // returning any UIImage in the universe constrained only to defaults
  • Random.image.unconstrained config option to remove any default constraints in compression or format
  • RandomImagePreferences struct with configurable options for contentType, format, compression level, sizeLimitation & others
  • ImageContentType enum // some specification of the type of content to return, eg: [.profilePhoto, .person, .animal, .nature, .sports]
  • ImageFormat // e.g. .gif, .jpg, .png, .hvec
  • ImageCompressionLimit // .uncompressed (default), .large, .small, .medium
  • ImageSizeLimitation accepting a double representing the maximum file size the image should be compressed to
  • Image compression function // already existing in one of our other projects
  • Random.image.prefs -- a setter / getter for prefs config & persistence / override
  • Random.image.with(_ format: ImageFormat)
  • Random.image.compressed(_ to: ImageCompressionLimit)
  • Random.image.limited(to fileSize: Double)
  • Save any images for a session to the /tmp/ directory
  • An option to specify whether or not to save the image permanently to the documents directory
  • An option to return all random images currently present in either /tmp/ or /documents

// TODO: evaluate a RandomImage object & properties vs extending UIImage

  • Random.image.localUrl returning the location on-device & from the correct bundle
  • Random.image.sourceUrl returning the original source
  • Random.image.extension returning the extension of the file type as a String for UniversalType indentification use with CoreMobileServices & drag / drop features\
  • Random.image.name returning only the source filename excluding extension
  • Random.image.fileName returning the filename including the extension
  • Random.image.size.kb returning size in KB
  • Random.image.size.mb returning size in MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions