PHP 7.4.33
Preview: image-size Size: 1.32 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/.bin/image-size
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-var-requires */
'use strict'

const fs = require('fs')
const path = require('path')
const { imageSize } = require('..')

const files = process.argv.slice(2)

if (!files.length) {
  console.error('Usage: image-size image1 [image2] [image3] ...')
  process.exit(-1)
}

const red = ['\x1B[31m', '\x1B[39m']
// const bold = ['\x1B[1m',  '\x1B[22m']
const grey = ['\x1B[90m', '\x1B[39m']
const green = ['\x1B[32m', '\x1B[39m']

function colorize(text, color) {
  return color[0] + text + color[1]
}

files.forEach(function (image) {
  try {
    if (fs.existsSync(path.resolve(image))) {
      const greyX = colorize('x', grey)
      const greyImage = colorize(image, grey)
      const size = imageSize(image)
      const sizes = size.images || [size]
      sizes.forEach((size) => {
        let greyType = ''
        if (size.type) {
          greyType = colorize(' (' + size.type + ')', grey)
        }
        console.info(
          colorize(size.width, green) +
            greyX +
            colorize(size.height, green) +
            ' - ' +
            greyImage +
            greyType,
        )
      })
    } else {
      console.error("file doesn't exist - ", image)
    }
  } catch (e) {
    // console.error(e.stack)
    console.error(colorize(e.message, red), '-', image)
  }
})

Directory Contents

Dirs: 0 × Files: 39
Name Size Perms Modified Actions
60 B lrwxr-xr-x 2025-03-28 11:04:34
Edit Download
4.25 KB lrwxr-xr-x 2025-03-28 11:04:33
Edit Download
3.03 KB lrwxr-xr-x 2025-03-28 11:04:31
Edit Download
371 B lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
5.15 KB lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
4.83 KB lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
7.56 KB lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
1.32 KB lrwxr-xr-x 2025-03-28 11:04:32
Edit Download
105 B lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
354 B lrwxr-xr-x 2025-03-28 11:04:31
Edit Download
2.67 KB lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
4.87 KB lrwxr-xr-x 2025-03-28 11:04:33
Edit Download
3.74 KB lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
3.51 KB lrwxr-xr-x 2025-03-28 11:04:34
Edit Download
356 B lrwxr-xr-x 2025-03-28 11:04:34
Edit Download
247 B lrwxr-xr-x 2025-03-28 11:04:33
Edit Download
101 B lrwxr-xr-x 2025-03-28 11:04:32
Edit Download
149 B lrwxr-xr-x 2025-03-28 11:04:31
Edit Download
1.79 KB lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
1.10 KB lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
12.52 KB lrwxr-xr-x 2025-03-28 11:04:38
Edit Download
985 B lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
328 B lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
855 B lrwxr-xr-x 2025-03-28 11:04:33
Edit Download
7.21 KB lrwxr-xr-x 2025-03-28 11:04:42
Edit Download
1.74 KB lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
1.50 KB lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
1.83 KB lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
657 B lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
4.61 KB lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
55 B lrwxr-xr-x 2025-03-28 11:04:31
Edit Download
623 B lrwxr-xr-x 2025-03-28 11:04:31
Edit Download
75 B lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
75 B lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
444 B lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
45 B lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
50 B lrwxr-xr-x 2025-03-28 11:04:36
Edit Download
912 B lrwxr-xr-x 2025-03-28 11:04:35
Edit Download
45 B lrwxr-xr-x 2025-03-28 11:04:37
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).