https://github.com/sethbrasile/ghost-cloudinary-store
A Cloudinary image storage module for Ghost blogs.
https://github.com/sethbrasile/ghost-cloudinary-store
Last synced: 3 months ago
JSON representation
A Cloudinary image storage module for Ghost blogs.
- Host: GitHub
- URL: https://github.com/sethbrasile/ghost-cloudinary-store
- Owner: sethbrasile
- Created: 2015-04-14T17:17:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-26T18:15:09.000Z (almost 5 years ago)
- Last Synced: 2024-03-17T12:00:47.541Z (about 1 year ago)
- Language: JavaScript
- Size: 97.7 KB
- Stars: 26
- Watchers: 3
- Forks: 14
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/sethbrasile/ghost-cloudinary-store) [](https://codeclimate.com/github/sethbrasile/ghost-cloudinary-store) [](https://codeclimate.com/github/sethbrasile/ghost-cloudinary-store/coverage) [](https://codeclimate.com/github/sethbrasile/ghost-cloudinary-store)
**DEPRECATED**
This is the original `ghost-cloudinary-store` but it will no longer receive regular updates or guarantee compatibility. [This repo](https://github.com/mmornati/ghost-cloudinary-store) on the other hand, is actively maintained, and is the repo backing the NPM package.
For issues and etc, go there.**IMPORTANT**: You **MUST** be running Ghost 1.0.0 or later.
**PLEASE** create an issue if you have any problems.
Cloudinary has some "advanced configuration options" for Pro users and etc.. that this module does not currently handle. If you would like support for these options added, please create an issue or submit a PR!
# To Use
[](https://greenkeeper.io/)
## NPM Installation Method
*In Ghost's root directory*
1. Run `npm install ghost-cloudinary-store` (note the lack of `--save`)
2. Install into the Ghost sources folder
2.1. Make the storage folder if it doesn't already exist `mkdir versions/$GHOST_VERSION/core/server/adapters/storage/`
2.2. Copy `ghost-cloudinary-store` from `node_modules` to `versions/$GHOST_VERSION/core/server/adapters/storage`
```
cp -r node_modules/ghost-cloudinary-store versions/$GHOST_VERSION/core/server/adapters/storage
```3. Install into the Ghost content folder
3.1. Make the storage folder if it doesn't already exist `mkdir /$CONTENT_FOLDER/content/adapters/storage/`
3.2. Copy `ghost-cloudinary-store` from `node_modules` to `$CONTENT_FOLDER/content/adapters/storage/`
```
cp -r node_modules/ghost-cloudinary-store $CONTENT_FOLDER/content/adapters/storage/
```4. Follow the instructions below for [editing config.js][1]
## Git Installation Method
Note: The `master` branch reflects what is published on NPM
1. Navigate to Ghost's base folder and create a directory called `versions/$GHOST_VERSION/core/server/adapters/storage`
2. Navigate into this new `storage` directory and run `git clone https://github.com/mmornati/ghost-cloudinary-store.git ghost-cloudinary-store`
3. Navigate into `ghost-cloudinary-store` and run `npm install`
4. Follow the instructions below for [editing config.js][1]
## Editing config.production.json
You have two options for configuring Ghost to work with your Cloudinary account:
1. By using your Cloudinary credentials: `cloud_name`, `api_key`, and `api_secret`.
2. By setting a `CLOUDINARY_URL` environment variable.#### With Cloudinary credentials
In Ghost's `config.production.json` (the file where you set your URL, mail settings, etc..) as follows:
Note: These values can be obtained from your Cloudinary management console.
```json
"storage": {
"active": "ghost-cloudinary-store",
"ghost-cloudinary-store": {
"cloud_name": "yourCloudName",
"api_key": "yourApiKey",
"api_secret": "yourApiSecret"
}
}
```Further reading available [here][2].
#### With a `CLOUDINARY_URL` environment variable
In Ghost's `config.production.json` (the file where you set your URL, mail settings, etc..) as follows:
```json
"storage": {
"active": "ghost-cloudinary-store"
}
```Then set the `CLOUDINARY_URL` environment variable, available from your Cloudinary management console.
It will look something like `CLOUDINARY_URL=cloudinary://874837483274837:a676b67565c6767a6767d6767f676fe1@sample`.
Further reading available [here][2].
If you don't know what an environment variable is, [read this][3].## Using Cloudinary API
You can find the documentation of what you can configure, directly on the Cloudinary website: http://cloudinary.com/documentation/image_transformations
```json
"storage": {
"active": "ghost-cloudinary-store",
"ghost-cloudinary-store": {
"cloud_name": "yourCloudName",
"api_key": "yourApiKey",
"api_secret": "yourApiSecret",
"configuration": {
"image": {
"quality": "auto:good",
"secure": "true"
},
"file": {
"use_filename": "true",
"unique_filename": "false",
"phash": "true",
"overwrite": "false",
"invalidate": "true",
"folder": "blog-images",
"tags": ["blog"]
}
}
}
}
```
**NOTE:** The **cloud_name**, **api_key** and **api_secret** environment variables are not needed if you use the **CLOUDINARY_URL** environment variable.A `configuration.sample.json`file can be found into the project source to help you configure the plugin.
The **file** part into the configuration json is used to define the filename to use. By default, without any configuration, cloudinary will select a random name for the uploaded image.
This can't allow you to block the same image to be uploaded plenty of times. Anytime you will upload the image it gets a new name.
Configuring this part you can, for example, force Cloudinary to use the name you are providing (it is up to you to be sure about the unicity of the name).You can find more information about and the list of possible parameters directly on the official Cloudinary documentation: http://cloudinary.com/documentation/image_upload_api_reference#upload
[1]: #editing-configproductionjson
[2]: http://cloudinary.com/documentation/node_additional_topics#configuration_options
[3]: https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps