gatsby-transformer-cloudinary
Advanced tools
Comparing version 0.3.3 to 0.3.4
const axios = require('axios'); | ||
// todo: for fluid images when original width and height is not set, use width and height of image as is and make full width | ||
// todo: investigate graphQL query overrides for width and height and abstract control to user through gql query | ||
// Define default width values for fluid, fixed and base64 images | ||
const DEFAULT_BASE64_WIDTH = 30; | ||
@@ -7,2 +10,3 @@ const DEFAULT_FIXED_WIDTH = 400; | ||
// Create Cloudinary image URL with transformations. | ||
const getImageURL = ({ | ||
@@ -34,2 +38,3 @@ public_id, | ||
// Fetch and return Base64 image | ||
const getBase64 = async url => { | ||
@@ -42,2 +47,3 @@ const result = await axios.get(url, { responseType: 'arraybuffer' }); | ||
// retrieve aspect ratio if in transformation else create aspect ratio values | ||
const getAspectRatio = (transformations, originalAspectRatio) => { | ||
@@ -59,2 +65,3 @@ const arTransform = transformations.find(t => t.startsWith('ar_')); | ||
// Create shared image data for both fixed and fluid. Returns src and Base64 | ||
const getSharedImageData = async ({ | ||
@@ -98,3 +105,3 @@ public_id, | ||
base64Width = DEFAULT_BASE64_WIDTH, | ||
base64Transformations = null, | ||
base64Transformations = [], | ||
transformations = [], | ||
@@ -154,7 +161,7 @@ chained = [], | ||
originalHeight, | ||
breakpoints, | ||
breakpoints = [200, 400, 600], | ||
version = false, | ||
maxWidth = DEFAULT_FLUID_MAX_WIDTH, | ||
base64Width = DEFAULT_BASE64_WIDTH, | ||
base64Transformations = null, | ||
base64Transformations = [], | ||
transformations = [], | ||
@@ -161,0 +168,0 @@ chained = [], |
{ | ||
"name": "gatsby-transformer-cloudinary", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "Transform local files into Cloudinary-managed assets for Gatsby sites.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
24488
392