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.7.110
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
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.

Immutable App Image uses Immutable Core Service to persist image type and image profile data globally. This data is used whenever images are displayed or uploaded. By default this data will be refreshed every 60 seconds so changes to image types and image profiles will not be reflected by application clients for up to 60 seconds.

Immutable App Image v0.3 and Immutable Core Model v3

Immutable App Image v0.3 is required to support the breaking changes that were made in Immutable Core Model v3.

Immutable App Image v0.3 is not compatible with Imutable Core Model v2.

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".

To support webp multiple profiles with the same name should be created. One of these profiles should be either jpg or png and the either should be webp.

FAQs

Package last updated on 01 Dec 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