Socket
Socket
Sign inDemoInstall

@upsidelab/vue-cdn-picture

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@upsidelab/vue-cdn-picture

Vue component for serving optimized images from CDN services


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

Vue CDN Picture

Documentation

For a full documentation visit: https://docs.upsidelab.io/vue-cdn-picture/

Getting Started

Modern CDNs and CMS systems provide ability to transform images that are to be served to the user. This makes it easier to optimize bandwidth usage, serve images in next-gen formats and provide multiple versions for HiDPI displays.

When it comes to the HTML markup, it gets a bit tricky. You still need to provide fallback for browsers that don't support .webp or picture HTML tag.

Vue CDN Picture is a simple library that makes it as simple as using the regular img tag. It's designed to work with CDNs and request images in optimal form, to optimize network usage.

Installing the library

yarn add @upsidelab/vue-cdn-picture

Example use

<GraphCmsCdnPicture
  image-handle="AmYDOhxYRoWKk2y8twQW"
  :width="800"
  :height="600"
/>

will result in the following HTML markup:

<picture>
  <source type="image/webp" srcset="https://media.graphcms.com/resize=w:800,h:600,fit:clip/output=format:webp/compress/AmYDOhxYRoWKk2y8twQW 1x,https://media.graphcms.com/resize=w:1600,h:1200,fit:clip/output=format:webp/compress/AmYDOhxYRoWKk2y8twQW 2x">
  <source type="image/jpeg" srcset="https://media.graphcms.com/resize=w:800,h:600,fit:clip/output=format:jpeg/compress/AmYDOhxYRoWKk2y8twQW 1x,https://media.graphcms.com/resize=w:1600,h:1200,fit:clip/output=format:jpeg/compress/AmYDOhxYRoWKk2y8twQW 2x">
  <img src="https://media.graphcms.com/resize=w:800,h:600,fit:clip/output=format:jpeg/compress/AmYDOhxYRoWKk2y8twQW" height="600" width="800">
</picture>

FAQs

Package last updated on 18 Jan 2022

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