npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bugfixdev-ghost-imagekit-store

v0.0.9

Published

ImageKit Ghost Storage adapter forked from offical https://github.com/imagekit-developer/ghost-imagekit-store

Downloads

2

Readme

bugfix.dev Changes.

forked from offical https://github.com/imagekit-developer/ghost-imagekit-store.

Fixed bug/issue.

  1. Converts windows and posix path to always posix path on image save.
  2. No need to set GHOST_CONTENT env variable on ghost startup.
  3. No need of updatedAt in image url, if useUniqueFileName = true.
  4. Working 13 tests cases.

To Use Image Transformation Dynamically use img_url.js (frontend helper).

ImageKit Ghost Storage

ImageKit's Ghost storage adapter.

Features

  • Up to date with the most recent Ghost release.
  • Uses the latest ImageKit NodeJS SDK.
  • Supports image read, existence check, and upload.
  • Serve existing images present in Ghost's default storage.
  • Ability to upload images into a specific directory.
  • Ability to configure uploads in dated subdirectories like the default Ghost local storage adapter in YYYY/MM format.
  • Use ImageKit's upload API to set tags, useUniqueFileName, and folder.

Installation

Using yarn

  • Go into your Ghost project's root directory.
  • Install the adapter:
yarn add bugfixdev-ghost-imagekit-store
cp node_modules/bugfixdev-ghost-imagekit-store/dist/src content/adapters/storage/imagekit/
  • Configure Ghost's config file.

Install on Docker

Here's an example of using this adapter with a containerized Ghost:

FROM ghost:5-alpine as imagekit
RUN apk add g++ make python3
RUN su-exec node yarn add bugfixdev-ghost-imagekit-store

FROM ghost:5-alpine
COPY --chown=node:node --from=imagekit $GHOST_INSTALL/node_modules $GHOST_INSTALL/node_modules
COPY --chown=node:node --from=imagekit $GHOST_INSTALL/node_modules/bugfixdev-ghost-imagekit-store/dist/src/index.js $GHOST_INSTALL/content/adapters/storage/imagekit/index.js
# Here, we use the Ghost CLI to set some pre-defined values.
RUN set -ex; \
    su-exec node ghost config storage.active imagekit; \
    su-exec node ghost config storage.imagekit.uploadOptions.useUniqueFileName true; \
    su-exec node ghost config storage.imagekit.uploadOptions.folder /ghost/blog;

Make sure the content path is correctly set in the Ghost configuration:

"paths": {
    "contentPath": "/var/lib/ghost/content/"
}

Configuration

Check out config.development.json or below for a complete example.

{
    "storage": {
        "active": "imagekit",
        "imagekit": {
            "enableDatedFolders": true,
            "auth": {
                "privateKey": "your-private-key",
                "publicKey": "your-public-key",
                "urlEndpoint": "https://ik.imagekit.io/your-imagekit-id"
            },
            "uploadOptions": {
                "useUniqueFileName": true,
                "folder": "/sample",
                "tags": ["blog"]
            }
        }
    },
    "imageOptimization": {
        "resize": false
    }
}
  • Make sure Ghost Image Optimization is disabled.
  • The optional enableDatedFolders setting allows uploading images into dated sub-directories (like the default Ghost Local Storage Adapter). It is true by default.
  • The auth property is used to configure your ImageKit account's credentials and URL endpoint. You can find them in the dashboard.
  • The uploadOptions property allows you to configure ImageKit's upload options. You can configure useUniqueFileName, folder, and tags.

Recommended configuration

  • uploadOptions.useUniqueFileName = true Ghost's local storage adaptor handles duplicate file names automatically. When uploading a file to a location where a file with the same name already exists, ImageKit creates a new file version. In order to avoid this, useUniqueFileName can be set to true.
  • uploadOptions.tags = ["travel", "discover"] if you want to add associations of tags to your uploaded images.
  • uploadOptions.folder = "/ghost/blog" allows to upload all your images into a specific directory in your ImageKit media library. By default, files are uploaded to the root of media library.

ImageKit dashboard settings

Ensure that Restrict unsigned image URLs settings is turned off in your ImageKit account. This is because the storage adapter currently does not support fetching images that require signed URLs, including private files.

Development

To install, run:

yarn install

To run tests and generate coverage, run:

yarn test

To build, run:

yarn build