[nodebb-plugin-image-sizer] Image resizing



  • Hi nodebb. Another friend from BitBangers here to show you my first plugin.

    Trying to look through a thread of phone screenshots was just painful, so I made a little plugin to allow you to resize images.

    The syntax is based loosely on the way iOS handles multple image sizes combined with normal markdown image embedding:
    ![alt text](http://someurl.com/someimage.png@<size>)

    Size can take the following formats:
    100x200 - Absolute size
    100x x200 - Absolute size where the other dimension is calculated to maintain aspect ratio
    50% - Percentage
    0.5 - Scalar Multiplier

    So for example, my original picture:

    is 1000x750.
    All of the following would produce the same image at 1/2 size:
    ![white house](http://cl.ly/image/2L3F1M2E1X3l/IMG_0136.JPG@500x375)
    ![white house](http://cl.ly/image/2L3F1M2E1X3l/IMG_0136.JPG@500x)
    ![white house](http://cl.ly/image/2L3F1M2E1X3l/IMG_0136.JPG@x375)
    ![white house](http://cl.ly/image/2L3F1M2E1X3l/IMG_0136.JPG@50%)
    ![white house](http://cl.ly/image/2L3F1M2E1X3l/IMG_0136.JPG@0.5)

    Install via npm:
    npm install nodebb-plugin-image-sizer

    Source:
    https://github.com/Kern--/nodebb-plugin-image-sizer

    Known Issues:
    Images that are set to be wider than their container become elongated (width is set to match the container, but height is not adjusted). This means that mobile can get a bit dicey.


Log in to reply
 

Suggested Topics

| |