{"id":13572898,"url":"https://github.com/ericrisco/astro-cloudinary-image","last_synced_at":"2025-04-13T03:09:39.425Z","repository":{"id":84528529,"uuid":"605333744","full_name":"ericrisco/astro-cloudinary-image","owner":"ericrisco","description":"This Astro component makes it easy to wrap the Cloudinary URL Generator library to dynamically generate and optimize images from the Cloudinary service.","archived":false,"fork":false,"pushed_at":"2023-08-13T19:48:31.000Z","size":150,"stargazers_count":36,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T03:09:23.619Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Astro","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericrisco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-22T23:56:48.000Z","updated_at":"2024-09-16T20:38:40.000Z","dependencies_parsed_at":"2024-01-14T03:51:03.584Z","dependency_job_id":"da49f6fb-a391-40df-913a-8d41982c1044","html_url":"https://github.com/ericrisco/astro-cloudinary-image","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"a7026c171461c86e54dbca6a2fb92a48fb8399d7"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrisco%2Fastro-cloudinary-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrisco%2Fastro-cloudinary-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrisco%2Fastro-cloudinary-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrisco%2Fastro-cloudinary-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericrisco","download_url":"https://codeload.github.com/ericrisco/astro-cloudinary-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657917,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:23.724Z","updated_at":"2025-04-13T03:09:39.404Z","avatar_url":"https://github.com/ericrisco.png","language":"Astro","funding_links":[],"categories":["Astro"],"sub_categories":[],"readme":"![astrocloudinary](https://user-images.githubusercontent.com/20164590/221385959-78078d28-79c3-40ec-b2c1-c4dfa01c03ad.png)\r\n\r\n# 🚀 Astro Cloudinary Image\r\n\r\nThis [Astro](https://astro.build/) component makes it easy to wrap the Cloudinary URL Generator library to dynamically generate and optimize images from the Cloudinary service.\r\n\r\nPull requests and/or feature requests are very welcome!\r\n\r\n## 🔥 Motivation\r\n\r\nThis project aims to participate in [@midudev](https://www.github.com/midudev) hackathon: [Cloudinary CloudCreate](https://cloudinary.com/blog/cloudinary-cloudcreate-tech-products-hackathon?utm_source=twitter\u0026utm_medium=social-company\u0026utm_campaign=1307\u0026utm_term=194\u0026utm_content=blog_cloudcreate_hackathon), in collaboration with [Cloudinary](https://cloudinary.com/).\r\n\r\n## 💻 Features\r\n\r\nBelow is a short list of features that **Astro Cloudinary Image** offers.\r\n\r\n- ✅ **Crops the image to fit the specified dimensions.**\r\n- ✅ **Scales the image to fill the specified dimensions.**\r\n- ✅ **Scales the image to the specified dimensions.**\r\n- ✅ **Scales the image to fit within the specified dimensions.**\r\n- ✅ **Generates a thumbnail of the image.**\r\n- ✅ **Centers the image around detected faces.**\r\n- ✅ **Automatically detects the subject of the image and centers it.**\r\n- ✅ **Add corner radius from 1px to max (round image)**\r\n- ✅ **Rotate the image**\r\n- ✅ **Applies various effects to the image.**\r\n\r\n## 🛠️ Installation\r\n\r\nTo install Astro Cloudinary Image, run the following command in your terminal:\r\n\r\n```bash\r\nnpm install astro-cloudinary-image\r\n```\r\n\r\nor if you use yarn:\r\n  \r\n```bash\r\nyarn add astro-cloudinary-image\r\n```\r\n\r\nor if you use pnpm:\r\n\r\n```bash\r\npnpm add astro-cloudinary-image\r\n```\r\n\r\n## 💻 How To Use\r\n\r\n1. In any of your Astro projects, you need to create a `.env` file and add your cloud name on Cloudinary, like: \r\n\r\n```bash\r\nCLOUDINARY_CLOUD_NAME=XXXXXXX\r\n```\r\n\r\nWhere `XXXXXXX` is your cloud name. Tip: You can find your Cloudinary Cloud Name right on the main Dashboard of your account.\r\n\r\n2. In any of your Astro pages, import `Cloudinary` and then use the component like:\r\n\r\n```astro\r\n---\r\nimport { Cloudinary } from 'astro-cloudinary-image';\r\n---\r\n\r\n\u003chtml lang=\"en\"\u003e\r\n  \u003chead\u003e\r\n    \u003cmeta charset=\"utf-8\" /\u003e\r\n    \u003clink rel=\"icon\" type=\"image/svg+xml\" href=\"/favicon.svg\" /\u003e\r\n    \u003cmeta name=\"viewport\" content=\"width=device-width\" /\u003e\r\n    \u003cmeta name=\"generator\" content={Astro.generator} /\u003e\r\n    \u003ctitle\u003eAstro\u003c/title\u003e\r\n  \u003c/head\u003e\r\n  \u003cbody\u003e  \r\n    \u003cCloudinary \r\n      width=\"800\"\r\n      height=\"400\"\r\n      resize=\"fill\"\r\n      gravity=\"face\"\r\n      cornerRadius=\"max\"\r\n      rotate={20}\r\n      effects={[\"backgroundRemoval\", \"sepia\"]}\r\n      alt=\"A sample image\"\r\n      src=\"cld-sample\" \r\n      errorImage=\"NotFound.svg\"\r\n    /\u003e\r\n  \u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n## 🗺️ Mandatory Props\r\n\r\n1. `src: string` - The URL of the image to be displayed. This `src` can be a full image url or the Cloudinary identifier on your media library\r\n\r\n2. `alt: string`\t- The alt text for the image.\r\n\r\n3. `errorImage: string` - A URL for a fallback image to display if the src image fails to load.\r\n\r\n## 🗺️ Optional Props\r\n\r\n1. `width?: string;` - Sets the width of the image. It accepts a string value that can be a number in pixels (e.g. \"100\", \"50\").\r\n\r\n2. `height?: string;` - Sets the height of the image. It accepts a string value that can be a number in pixels (e.g. \"100\", \"50\").\r\n\r\n3. `resize?:` - Specifies the resizing behavior of the image. It can have one of the following values:\r\n\r\nResize | Option\tDescription\r\n------------ | ------------- \r\n\"crop\" |\tCrops the image to fit the specified dimensions.\r\n\"fill\" |\tScales the image to fill the specified dimensions.\r\n\"scale\" |\tScales the image to the specified dimensions.\r\n\"minimumPad\" |\tScales the image to fit within the specified dimensions, adding padding if necessary.\r\n\"fit\" |\tScales the image to fit within the specified dimensions.\r\n\"limitFit\" |\tScales the image down to fit within the specified dimensions, but doesn't scale it up.\r\n\"thumbnail\" |\tGenerates a thumbnail of the image.\r\n\"limitFill\" |\tScales the image up or down to fill the specified dimensions, but doesn't crop it.\r\n\"minimumFit\" |\tScales the image up or down to fit within the specified dimensions, but doesn't scale it beyond its original size.\r\n\"limitPad\" |\tScales the image down to fit within the specified dimensions, adding padding if necessary, but doesn't scale it up.\r\n\"fillPad\" |\tScales the image up or down to fill the specified dimensions, adding padding if necessary.\r\n\r\n4. `Gravity?:` - Specifies the gravity or position of the image. It can have one of the following values:\r\n\r\nGravity | Option\tDescription\r\n------------ | ------------- \r\n\"face\" | centers the image around detected faces.\r\n\"auto\" | automatically detects the subject of the image and centers it.\r\n\r\n5. `cornerRadius?:` number | \"max\"; - Specifies the radius of the corners of the image. It accepts a number value that represents the radius in pixels or the string value \"max\" that sets the maximum possible radius.\r\n\r\n6. `rotate?:` number; - Rotates the image by a specified angle in degrees.\r\n\r\n7. `effects?:` - Applies various effects to the image. It can have one or more of the following values:\r\n\r\nEffect | Option\tDescription\r\n------------ | ------------- \r\n\"blur\" | blurs the image.\r\n\"grayscale\" | converts the image to grayscale.\r\n\"sepia\" | adds a sepia tone to the image.\r\n\"shadow\" | adds a drop shadow to the image.\r\n\"colorize\" | applies a color overlay to the image.\r\n\"oilPaint\" | applies an oil painting effect to the image.\r\n\"cartoonify\" | applies a cartoon effect to the image.\r\n\"outline\" | adds an outline to the image.\r\n\"blackwhite\" | converts the image to black and white.\r\n\"makeTransparent\" | makes the background of the image transparent.\r\n\"vectorize\" | converts the image to a vector format.\r\n\"gradientFade\" | applies a gradient fade effect to the image.\r\n\"assistColorBlind\" | simulates the experience of color blindness.\r\n\"backgroundRemoval\" | removes the background of the image.\r\n\"dropShadow\" | adds a drop shadow to the image.\r\n\r\n__**In order to use `backgroundRemoval` you must activate `Cloudinary AI Background Removal` on Addons of your Cloudinary account. The `backgroundRemoval` must be allways the first effect**__\r\n\r\n# ✅ Live Example\r\n\r\nIf you want to view live examples of the component, clone this repo and `npm run dev` it.\r\n\r\n## \r\n\r\nIf you want to report any issues or have found a missing feature, please report it on [GitHub](https://github.com/ericrisco/astro-cloudinary-image/issues)!\r\n\r\nGood luck out there, Astronaut. 🚀\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrisco%2Fastro-cloudinary-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericrisco%2Fastro-cloudinary-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrisco%2Fastro-cloudinary-image/lists"}