Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

immutable-app-image

Package Overview
Dependencies
Maintainers
1
Versions
402
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-app-image

Immutable app image module

  • 0.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

immutable-app-image

Immutable App Image is an immutable-app module that provides image upload, editing and storage functionality.

Immutable App Image uses Cropper.js to crop images on the client side prior to uploading and sharp to process images on the backend.

Images are stored via an mz/fs compatible file system which can be the local file system or a remote virtual file system such as gcsfs.

Image Schema

Image

Property nameDescription
fileNamestring param case file name will have id and type appended
fileTypestring encoding type (jpg
imageNamestring user provided name for description
imageTypeIdid for Image Type
metaobject user provided meta data for image
pathstring location of image in file system

The Image model stores basic information about the original image uploaded by the user.

The fileName of the image is constructed from the param-case name, the Image id and the fileType.

For example: if the user provided name is "My Vacation" the fileName might be: "my-vacation-8449328a1eedfd27b1214d7d4fb16315.jpg".

The path of the image is relative to the base of the file system and does not include the fileName.

The meta data for an image can include anything. In the meta data lat and 'lng' should be used as the properties for geo location, title should be used for a single line description of the image, description should be used for a longer multi-line description of the image, and createTime should be used to store the datetime when the image was originally taken.

Image Type

Property nameDescription
cropClientstring crop image on client (always
fileTypestring encoding type (jpg
heightinteger image height
imageTypeNamestring image type name
maxClientHeightinteger maximum image height to upload from client
maxClientWidthinteger maximum image width to upload from client
maxHeightinteger maximum image height
maxWidthinteger maximum image width
qualityinteger 0-100 quality for jpg and webp image encoding
widthinteger image width

Image Types are used for categorizing images and defined how images are uploaded and stored.

The clientCrop parameter determines whether or not cropping and encoding will be done by the client.

By default clientCrop is set to best which means that the image will only be cropped by the client if it exceeds the maxClientHeight or maxClientWidth values.

Cropping on the client will reduce upload times for large images but that may come at the price of reduced image quality.

The fileType determines how the file will be stored on the server.

If maxHeight and/or maxWidth properties are set they will limit the size of the image but aspect ratio will be maintained and the image will not be upscaled if it is less than the maxHeight/maxWidth.

If height and/or width are set the image will the scaled to exactly these values. Image may be upscaled and aspect ratio may not be maintained.

Image Profile

Property nameDescription
fileTypestring encoding type (jpg
heightinteger image height
imageProfileNamestring image profile name
maxHeightinteger maximum image height
maxWidthinteger maximum image width
pregenerateboolean generate images for for profile in advance
qualityinteger 0-100 quality for jpg and webp image encoding
widthinteger image width

Image Profiles define different versions of an image that will be made available for download.

One or more Image Profiles can be linked to an Image Type.

The name for a profile must be in param case: i.e. lower case, dashes, and no spaces.

If the preGenerate property is set then when an image is uploaded a version of for the Image Profile will be created.

Pre-generated images are stored with the profile name afer the id and before the fileType like: "my-vacation-8449328a1eedfd27b1214d7d4fb16315-thumbnail.jpg".

Image Album

Property nameDescription
namestring album name
descriptionstring album description
imageTypeIdid for Image Type

Albums allow users to categorize images.

Albums can only contain images of the same Image Type.

Presentation of Images to users is based on a 3-level structure where the first level is Image Type, the 2nd level is images that have not been assigned to an album, and the 3rd level is images for a particular album.

FAQs

Package last updated on 07 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc