npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@imgproxy/imgproxy-js-core

v1.0.8

Published

imgproxy-js-core package is designed to be used as part of framework-specific packages and plugins.

Downloads

8,671

Readme


imgproxy is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security. It is a Go application, ready to be installed and used in any Unix environment—also ready to be containerized using Docker.

imgproxy can be used to provide a fast and secure way to get rid of all the image resizing code in your web application (like calling ImageMagick or GraphicsMagick, or using libraries), while also being able to resize everything on the fly on a separate server that only you control. imgproxy is fast, easy to use, and requires zero processing power or storage from the main application. imgproxy is indispensable when handling image resizing of epic proportions, especially when original images are coming from a remote source.

imgproxy-js-core package is designed to be used as part of framework-specific packages and plugins.

Install

npm install @imgproxy/imgproxy-js-core

Usage

import { generateUrl } from "@imgproxy/imgproxy-js-core";

const url = generateUrl(
  {
    value: "https://example.com/image.jpg",
    type: "plain",
  },
  {
    width: 150,
    height: 150,
    format: "webp",
    quality: 80,
    enlarge: "t",
    extend: {
      extend: 1,
      gravity: { type: "nowe", y_offset: 5 },
    },
    blur: 5,
    zoom: 1.5,
  }
);

Methods

generateUrl(URL, options)

This method generates an imgproxy URL based on the provided source and options.

The imgproxy-js-core library exposes a method called generateUrl, which takes two arguments:

  • URL (required): An object that contains the value and type properties.
    • value (required): A string that contains the URL of the image.
    • type (optional): A string that specifies the type of the URL. It can be one of the following:
      • plain: A plain URL.
      • base64: A base64 encoded URL.
      • encoded: An AES-CBC encrypted URL.
  • options (optional): An object that contains imgproxy options.

For a detailed description of the available options, please refer to the imgproxy documentation, as well as the option types files in the imgproxy-js-core library.

The generateUrl method returns a string that contains the generated URL.

generateImageInfoUrl(URL, options)

This method ia available only for the PRO version of imgproxy.

This method generates an imgproxy URL based on the provided source and options.

The imgproxy-js-core library exposes a method called generateImageInfoUrl, which takes two arguments:

  • URL (required): An object that contains the value and type properties.
    • value (required): A string that contains the URL of the image.
    • type (optional): A string that specifies the type of the URL. It can be one of the following:
      • plain: A plain URL.
      • base64: A base64 encoded URL.
      • encoded: An AES-CBC encrypted URL.
  • options (optional): An object that contains imgproxy options.

For a detailed description of the available options, please refer to the imgproxy documentation, as well as the option types files in the imgproxy-js-core library.

The generateImageInfoUrl method returns a string that contains the generated URL.

Development

  1. Clone the repo
  2. Install dependencies
npm install
  1. Run dev server
npm run dev