ghost-storage-cloudinary
ghost-storage-cloudinary copied to clipboard
Support for store all uploaded files such as video,pdf etc.
@eexit I am using this plugin with ghost self-hosted sever. I noticed that this plugin only manage images with cloudinary. Ghost also provide facility of uploading video, audio etc. to sever. When I upload other file it get uploaded to local file storage of my server. But in order to make my app state less I have to store all the uploaded files to cloudinary. I thinks its best add support for it to the library.
Thanks!
Hey @anuragkumar19,
A good start would be "Hello".
This storage adapter has been out there since pre-version 1 of Ghost and according to my research, it's not been a year since Ghost allows any file types to be uploaded. It takes time to track all Ghost features 😉
It seems like Cloudinary allows to upload any kind of file, which is excellent. Now, we only need to implement and test this.
Want to contribute?
Thanks!
Hi! @eexit I was trying to find a way to do it. After a bit of reasearch I found that we can do that very easily with little bit of change.
"storage": {
"active": "LocalImagesStorage",
"media": "LocalMediaStorage",
"files": "LocalFilesStorage",
"LocalMediaStorage": {},
"LocalFilesStorage": {}
},
Source: https://github.com/TryGhost/Ghost/blob/fa1861aad3ba4e5e1797cec346f775c5931ca856/ghost/core/core/shared/config/defaults.json
They use key:-active
for image adapter which didn't hint me at first that there exist other configuration otions like media,files
which I can configure to make my work done. But going through the files led me this.
We have to write two more files one for files
and one for media
and rename the index file. Now we have to move dirctly in content/storage/adapter
instead of content/adapters/storage/ghost-storage-cloudinary
. As these are major changes and break the other application running. We have to release a new major version.
CloudinaryImagesStorage.js
CloudinaryMediaStorage.js
CloudinaryFilesStorage.js
New conf:
"storage": {
"active": "CloudinaryImagesStorage",
"media": "CloudinaryMediaStorage",
"files": "CloudinaryFilesStorage",
"CloudinaryMediaStorage": {},
"CloudinaryFilesStorage": {},
"CloudinaryImagesStorage": {},
},
We have another option to create two other library one for media
and one for files
. It will not break the other application and people who want to use this feature just add that libraries.
Waiting for your opinion on this.
Thanks!