drupal-image-style-generator 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -135,7 +135,7 @@ module.exports = function (options) {
|
|
|
135
135
|
cropTypes[cropType].soft_limit_height = Math.round(Math.max(cropTypes[cropType].soft_limit_height, styleWidth * aspectRatio));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
styleLabel = `Manual Crop and Scale ${styleWidth}`;
|
|
138
|
+
styleLabel = `Manual Crop and Scale ${styleWidth}, aspect ${cropDimensions[0]}:${cropDimensions[1]}`;
|
|
139
139
|
concreteStyleId = `mc_${styleWidth}_${cropType}`;
|
|
140
140
|
styleFileName = `image.style.${concreteStyleId}.yml`;
|
|
141
141
|
styleFilePath = `${syncFolder}/${styleFileName}`;
|
|
@@ -364,6 +364,7 @@ module.exports = function (options) {
|
|
|
364
364
|
label: type.label,
|
|
365
365
|
id: cropTypeId,
|
|
366
366
|
description: type.label,
|
|
367
|
+
aspect_ratio: type.aspect_ratio,
|
|
367
368
|
soft_limit_width: type.soft_limit_width,
|
|
368
369
|
soft_limit_height: type.soft_limit_height,
|
|
369
370
|
hard_limit_width: null,
|
|
@@ -371,6 +372,13 @@ module.exports = function (options) {
|
|
|
371
372
|
}
|
|
372
373
|
;
|
|
373
374
|
|
|
375
|
+
// adjust in case something changed
|
|
376
|
+
cropTypeConfig.label = type.label;
|
|
377
|
+
cropTypeConfig.description = type.label;
|
|
378
|
+
cropTypeConfig.aspect_ratio = type.aspect_ratio;
|
|
379
|
+
cropTypeConfig.soft_limit_width = type.soft_limit_width;
|
|
380
|
+
cropTypeConfig.soft_limit_height = type.soft_limit_height;
|
|
381
|
+
|
|
374
382
|
usedCropTypes[cropTypeFileName] = true;
|
|
375
383
|
|
|
376
384
|
fs.writeFileSync(cropTypePath, yaml.dump(cropTypeConfig));
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
uuid:
|
|
1
|
+
uuid: 827d0f50-37d3-498e-bd3b-8e3d22dfaa3e
|
|
2
2
|
langcode: de
|
|
3
3
|
status: true
|
|
4
4
|
dependencies: {}
|
|
5
5
|
label: Aspect Ratio 165:266
|
|
6
6
|
id: aspect_165x266
|
|
7
7
|
description: Aspect Ratio 165:266
|
|
8
|
+
aspect_ratio: '165:266'
|
|
8
9
|
soft_limit_width: 1320
|
|
9
10
|
soft_limit_height: 2128
|
|
10
11
|
hard_limit_width: null
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
uuid:
|
|
1
|
+
uuid: 698948e3-f72e-4a10-88ca-c3c8fbc2122c
|
|
2
2
|
langcode: de
|
|
3
3
|
status: true
|
|
4
4
|
dependencies: {}
|
|
5
5
|
label: Aspect Ratio 635:424
|
|
6
6
|
id: aspect_635x424
|
|
7
7
|
description: Aspect Ratio 635:424
|
|
8
|
+
aspect_ratio: '635:424'
|
|
8
9
|
soft_limit_width: 580
|
|
9
10
|
soft_limit_height: 387
|
|
10
11
|
hard_limit_width: null
|
package/test/test.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const expect = require('chai').expect;
|
|
2
2
|
const gen = require('../index');
|
|
3
3
|
const fs = require("fs");
|
|
4
|
+
const yaml = require("js-yaml");
|
|
4
5
|
|
|
5
6
|
describe('Running image generator tests', function () {
|
|
6
7
|
|
|
@@ -83,6 +84,10 @@ describe('Running image generator tests', function () {
|
|
|
83
84
|
'image.style.mc_660_aspect_165x266.yml',
|
|
84
85
|
'responsive_image.styles.frontpage_hero.yml'
|
|
85
86
|
]);
|
|
87
|
+
|
|
88
|
+
const cropYml = yaml.load(fs.readFileSync(syncFolder + 'crop.type.aspect_165x266.yml', 'utf8'));
|
|
89
|
+
expect(cropYml).to.be.an('object');
|
|
90
|
+
expect(cropYml.aspect_ratio).to.equal('165:266');
|
|
86
91
|
});
|
|
87
92
|
|
|
88
93
|
});
|