cloudinary-community / next-cloudinary

⚑️ High-performance image delivery and uploading at scale in Next.js powered by Cloudinary.
https://next.cloudinary.dev
MIT License
257 stars 75 forks source link
cloudinary hacktoberfest nextjs
Cloudinary

  

GitHub Workflow Status npm npm bundle size GitHub

Next Cloudinary

undefined

High-performance image delivery and uploading at scale in Next.js powered by Cloudinary.

Features β€’ Getting Started β€’ Community & Support β€’ Contributing

This is a community library supported by the Cloudinary Developer Experience team.

✨ Features

πŸš€ Getting Started

Installation

npm install next-cloudinary

Adding an Image

import { CldImage } from 'next-cloudinary';

<CldImage width="600" height="600" src="https://github.com/cloudinary-community/next-cloudinary/raw/main/<Public ID or Cloudinary URL>" alt="<Alt Text>" />

Learn more about CldImage on the Next Cloudinary Docs

Generating an Social Media Card (Open Graph)

<CldOgImage src="https://github.com/cloudinary-community/next-cloudinary/raw/main/<Public ID or Cloudinary URL>" text="Next Cloudinary" />

Note: The width and height is not required (or recommended) to comply with standardized social media card sizing of a 2:1 aspect ratio.

Learn more about CldOgImage on the Next Cloudinary Docs

Other Use Cases

❀️ Community & Support

πŸ›  Contributing

Please read CONTRIBUTING.md prior to contributing.

Working Locally

Installation

This project is using pnpm as a way to manage dependencies and workspaces.

With the project cloned, install the dependencies from the root of the project with:

pnpm install

Configuration

To work on the project, you need to have an active Cloudinary account. With the account, configure a .env.local file inside of docs with:

NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME="<Your Cloudinary Cloud Name>"
NEXT_PUBLIC_CLOUDINARY_API_KEY="<Your Cloudinary API Key>"
CLOUDINARY_API_SECRET="<Your Cloudinary API Secret>"

Note: The Cloudinary account can be free, but some features may not work beyond free tier like Background Removal

The Cloud Name is required for all usage, where the API Key and Secret currently is only used for Upload Widget usage. The Upload Preset is additionally used for the Upload Widgets.

Uploading Example Images

In order to run the Docs project, you need to have the images referenced available inside of your Cloudinary account.

To do this, navigate to the scripts directory and first create a new .env file with:

CLOUDINARY_CLOUD_NAME="<Your Cloudinary Cloud Name>"
CLOUDINARY_API_KEY="<Your API Key>"
CLOUDINARY_API_SECRET="<Your API Secret>"

Then run the upload script with:

pnpm upload

By default, the images inside of scripts/images.json will be uploaded to the "images" directory inside of your Cloudinary account. To change the location, add the CLOUDINARY_IMAGES_DIRECTORY environment variable with your preferred directory:

CLOUDINARY_IMAGES_DIRECTORY="<Your Directory>"

Running the Project

Once installed and configured, open two terminal tabs, navigating one to next-cloudinary and one to docs, running the following command in each:

pnpm dev

The project will now be available at https://localhost:3000 or the configured local port.

Running Tests

All tests are located inside of next-cloudinary/tests with a directory structure that should reflect next-cloudinary/src.

While inside next-cloudinary, run tests with:

pnpm test

Contributors

Colby Fayock
Colby Fayock

πŸ’» πŸ“– πŸ’‘
Daniel Olavio
Daniel Olavio

πŸ’»
ramadevsign
ramadevsign

πŸ”§
Karey Higuera
Karey Higuera

⚠️ πŸ’»
Azanul Haque
Azanul Haque

πŸ”§
3t8
3t8

πŸ“–
John Agbanusi
John Agbanusi

πŸ’» πŸ“–
Joan LeΓ³n
Joan LeΓ³n

πŸ“–
Tim Benniks
Tim Benniks

πŸ’» πŸ“–
csgochan
csgochan

πŸ“–
codingis4noobs2
codingis4noobs2

πŸ’» ⚠️
michizhou
michizhou

πŸ’»
Lee Conlin
Lee Conlin

πŸ’»
Ryan Smith
Ryan Smith

πŸ’»
Michael Liendo
Michael Liendo

πŸ“–
Jack
Jack

πŸ’»
Matheus Cabral
Matheus Cabral

πŸ’»
Jose Morales
Jose Morales

πŸ’»
Eric Pfister
Eric Pfister

πŸ’»
Joshua Olorunnipa
Joshua Olorunnipa

πŸ’»
Hari
Hari

πŸ“–
Shoaib Asgar
Shoaib Asgar

πŸ’»
Adeyanju Adeyemi
Adeyanju Adeyemi

πŸ’»
Simon
Simon

πŸ“–
Richard Oliver Bray
Richard Oliver Bray

πŸ’»
zecka
zecka

πŸ’»
Harshit Vashisht
Harshit Vashisht

πŸ“–
Sahil Silare
Sahil Silare

πŸ’»
Yash Mathur
Yash Mathur

πŸ’»
Abdul Samad
Abdul Samad

πŸ“–
Rishav Chattopadhyay
Rishav Chattopadhyay

πŸ“–
Prathamesh Gawas
Prathamesh Gawas

πŸ“–
Nwani Victory
Nwani Victory

πŸ“– πŸ’»
Pratyay Banerjee
Pratyay Banerjee

πŸ“–
Saai Syvendra
Saai Syvendra

πŸ“–