Socket
Socket
Sign inDemoInstall

@mapado/image-url-builder

Package Overview
Dependencies
Maintainers
7
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapado/image-url-builder

Build mapado image in JS


Version published
Weekly downloads
0
decreased by-100%
Maintainers
7
Weekly downloads
 
Created
Source

Mapado Image JS Url Builder

Installation

npm install "@mapado/image-url-builder"

or with yarn:

yarn add "@mapado/image-url-builder"

Usage

import { buildUrl } from '@mapado/image-url-builder';

const imagePath = '2018/01/foo.jpg';
const fullWidthImage = buildUrl(imagePath);

// will output something like '//img.mapado.net/2018/01/foo.jpg'

You can also specify a width and a height to crop / resize the image:

const width = 400;
const height = 300;
const cropedImage = buildUrl(imagePath, width, height);

// will output something like '//img.mapado.net/2018/01/foo_thumbs/400-300.jpg'

If you don't want to resize or apply any filter but want to allow webp format for compatible browser, you have two options:

  • you can set the option allowwebp: 1
  • you can set both width and height to 0
const webpAllowedImage = buildUrl(imagePath, null, null, {allowwebp: 1});
const alsoWebpAllowedImage = buildUrl(imagePath, 0, 0);

// will both output something like '//img.mapado.net/2018/01/foo.jpg_thumbs/0-0.jpg'

FAQs

Package last updated on 31 May 2024

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