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

sky-crop

v2.1.1

Published

Vue component for cropping images

Downloads

22

Readme

sky-crop

VueJS module for cropping images from umbraco imageprocessor (http://imageprocessor.org/imageprocessor-web/).

Only requirement is that the original size of the image is included in the url parameters.

  • ImageProcessor/Umbraco urls - eg. [imagePath]?anchor=center&height=600&width=1000

Installation

npm install sky-crop

or

yarn add sky-crop

Usage

Begin by importing and installing the SkyCrop Vue plugin:

import Vue from 'vue';
import SkyCrop from 'sky-crop';

// If you want to use the baseline scss add the following line
import '${YOUR-PROJECT-ROOT-PATH}/node_modules/sky-crop/dist/sky-crop.css';

Vue.use(SkyCrop);

The <sky-crop> component registers globally and can now be used.

Basic example:

<sky-crop src="/your-image.png?anchor=center&height=600&width=1000" />

Advanced example:

<sky-crop
  src="/your-image.png?anchor=center&height=600&width=1000"
  mode="cover"
  :round="100"
  :options="{ upscale: false }"
/>

Available attributes (optional):

Read as attributeName="defaultValue" [supported types]

  • mode="width" [String] : 'width', 'height', 'cover', 'contain'
  • :round="100" [Number]
  • :options="{ upscale: false }"
  • alt="alternative text" [String]

mode

Best result will be given if the container has width and height set in css.

width

  • image will fill entire container width - height will be based on the image original ratio.
  • only width dimension is required in this mode.

height

  • image will fill entire container height - width will be based on the image original ratio.
  • only height dimension is required in this mode.

contain

  • image will always be fully visible.
  • height and width is required in this mode.

cover

  • image will fill entire container - overflow is hidden.
  • height and width is required in this mode.

round

Indication of how often you would like a recrop of your image.

Case: image is loaded and starts with cropped dimensions at 350x350. At round="100" should the image be stretch to more than 400 in width and/or 400 in height, a recrop will be initiated.

options

A hook for using all available methods provided by imageprocessor - for a full reference see this link: http://imageprocessor.org/imageprocessor-web/imageprocessingmodule/

alt

Native <img /> attribute, great for a11y.


Events:

The SkyCrop component emits two events:

  • loaded - when a cropped image finishes loading, the emitted data it the loaded src url.
  • loading - when fetching of a new crop is ongoing

Note: These events can be triggered multiple times per component - for instance if the viewport is resized and a new crop is needed.

Example:

<sky-crop
  src="/your-image.png?anchor=center&height=600&width=1000"
  mode="cover"
  round="200"
  @loaded="yourOnImageLoadedMethod"
  @loading="yourOnImageLoadingMethod"
/>

Credits

This module is made by the Frontenders at skybrud.dk. Feel free to use it in any way you want. Feedback, questions and bugreports should be posted as issues. Pull-requests appreciated!