This package has been deprecated

Author message:

Use resizin, resizin-react or resizin-node package instead.

ackee-image-server

1.4.5 • Public • Published

This package is not maintained anymore. Use one of these packages instead

Contains uploading component for upload images and build component to easily building URL for getting chosen image from server. Interactive documentation here.

Upload component

  • Package import

        ES5: const uploadImage = require("ackee-image-server").uploadImage; 
        ES6: import { uploadImage } from "ackee-image-server";
  • Initialization

        const bucketUploader = uploadImage.bind(
            null, 
            url = "https://imageserver-admin-api.ack.ee/api/v1/image/upload", 
            api_key = "56ebbff9276e563e008687d1"
        );

Upload

  • Upload in browser (get file using jQuery)

        $('#fileinput').live('change', function(){ 
          	var files = $('#fileinput').prop('files');
            var promise = bucketUploader( 
                id = "File name", 
                files[0]
            );
        });
        <input type="file" id="fileinput" />
  • Upload in Node.js

        const fs = require('fs');
    
        const file = fs.createReadStream(__dirname + '/myfile.png');
        var promise = bucketUploader(
            'imageid', 
            file
        );

Build URL component

  • Package import

        ES5: const buildSource = require("ackee-image-server").buildSource;
        ES6: import { buildSource } from "ackee-image-server";
  • Bucket initialization

        const bucketBuilder = buildSource.bind(
            null, 
            url = 'https://img.ack.ee', 
            bucket_alias = "test"
        );
  • Building URL

        var url = bucketBuilder(
            id = 'pepus', 
            {
                width: 250, 
                left: '20', 
                filter: 'sepia', 
                rotate: 90, 
                border: [10, 20]
            }
        )
  • Result

Built URL in a HTML element <img>

alt tag

  • Modifiers List of available modifiers.
Modifier Shortcut Available options
width w
height h
filter f sepia, grayscale, sharpen, blur, negative, edge, gauss
size s
gravity g north, south, east, center, west, northeast, southeast, southwest, face
crop c fill, fit, pad, scale, cut, face
left l
top t
rotate r 90, 180, 270, 360
border b [top, right, bottom, left]
backgroundColor bg #hexColor, rgb()
quality q
upscale u

Modifiers usage demo here.

License

MIT

Jakub Baierl & Jiří Šmolík

Package Sidebar

Install

npm i ackee-image-server

Weekly Downloads

2

Version

1.4.5

License

MIT

Unpacked Size

347 kB

Total Files

129

Last publish

Collaborators

  • ackeecz
  • borecekbaji