{"id":13621025,"url":"https://github.com/Frameright/react-image-display-control","last_synced_at":"2025-04-14T22:33:12.218Z","repository":{"id":171000560,"uuid":"646791091","full_name":"Frameright/react-image-display-control","owner":"Frameright","description":"🚀 Next-gen responsive images in React","archived":false,"fork":false,"pushed_at":"2025-04-08T04:07:13.000Z","size":1213,"stargazers_count":26,"open_issues_count":9,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-13T10:43:44.892Z","etag":null,"topics":["frameright","image","image-display-control","image-manipulation","image-publishing","iptc-metadata","metadata","metadata-extraction","metadata-parser","react","reactjs","responsive-design","responsive-images","responsive-layout"],"latest_commit_sha":null,"homepage":"https://react.frameright.io","language":"TypeScript","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/Frameright.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-29T10:53:34.000Z","updated_at":"2025-04-08T04:07:10.000Z","dependencies_parsed_at":"2023-10-13T04:04:09.349Z","dependency_job_id":"39bce22e-0cb9-416b-b29b-98df1a930937","html_url":"https://github.com/Frameright/react-image-display-control","commit_stats":null,"previous_names":["aurelienlourot/react-image-display-control"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Freact-image-display-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Freact-image-display-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Freact-image-display-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Freact-image-display-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frameright","download_url":"https://codeload.github.com/Frameright/react-image-display-control/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248972651,"owners_count":21191836,"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":["frameright","image","image-display-control","image-manipulation","image-publishing","iptc-metadata","metadata","metadata-extraction","metadata-parser","react","reactjs","responsive-design","responsive-images","responsive-layout"],"created_at":"2024-08-01T21:01:01.847Z","updated_at":"2025-04-14T22:33:12.147Z","avatar_url":"https://github.com/Frameright.png","language":"TypeScript","readme":"[\u003cimg src=\"https://avatars.githubusercontent.com/u/35964478?s=200\u0026v=4\" align=\"right\" width=\"64\" height=\"64\"\u003e](https://frameright.io)\n[![npm version](https://img.shields.io/npm/v/@frameright/react-image-display-control)](https://www.npmjs.com/package/@frameright/react-image-display-control)\n[![github actions](https://github.com/Frameright/react-image-display-control/actions/workflows/main.yml/badge.svg)](https://github.com/Frameright/react-image-display-control/actions/workflows/main.yml)\n\n\u0026nbsp;\n\n\u003c!--\nWARNINGS:\n* Bits of information here are duplicated in several places:\n    * https://docs.frameright.io/react\n    * https://github.com/Frameright/react-image-display-control\n  Make sure to keep them in sync.\n* Make sure all URLs in this document are absolute, and not relative within\n  GitHub, as we are publishing this file to NPM and want URLs to remain valid\n  there.\n--\u003e\n\n# Image Display Control React Component\n\n\u003e **➡️ See this document rendered at [docs.frameright.io/react](https://docs.frameright.io/react)**\n\nAn easy way to do [Image Display Control](https://frameright.io) in your React\nweb app. Made with :heart: by [Frameright](https://frameright.io). Power\nto the pictures!\n\n\u003e **Less than 5kB in your final client-side bundle.**\n\n\u0026emsp; :sparkles: [Live demo](https://react.frameright.io)\n\n\u0026emsp; 💻 [CodeSandbox](https://codesandbox.io/s/image-display-control-react-component-m6qj9r)\n\n## Table of Contents\n\n\u003c!-- toc --\u003e\n\n- [Overview](#overview)\n  * [Without this component](#without-this-component)\n  * [Basic usage](#basic-usage)\n- [Image Display Control metadata](#image-display-control-metadata)\n- [Installation](#installation)\n- [Usage](#usage)\n\n\u003c!-- tocstop --\u003e\n\n## Overview\n\nThis React component extends any `\u003cimg\u003e`-like element/component with the ability\nto retrieve Image Display Control metadata from its image file in order to\nautomatically and responsively zoom in on the most interesting part of the\nimage.\n\nIt integrates nicely with other advanced features you may be using in your\nexisting project, e.g.:\n* [image candidates (srcset)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset),\n  whether you define them yourself or whether they are generated on your behalf\n  by another component like\n  [Next.js `\u003cImage\u003e`](https://nextjs.org/docs/api-reference/next/image),\n* [server-side rendering](https://docs.frameright.io/react/ssr)\n  and static site generation, e.g. in a Next.js or in a Vite-based project.\n\nIt doesn't change the structure of your DOM: your existing CSS rules still\napply.\n\n\u0026emsp; :sparkles: [Live demo](https://react.frameright.io)\n\n\u0026emsp; :bulb: [GitHub Discussions](https://github.com/Frameright/react-image-display-control/discussions)\n\n\u003e **NOTE**: if you are not using React, you may want to have a look at the\n\u003e [Image Display Control Web component](https://github.com/Frameright/image-display-control-web-component)\n\u003e instead.\n\n### Without this component\n\nWhen an image is too big for its `\u003cimg\u003e` HTML element, the best option browsers\noffer nowadays is to use the\n[`object-fit: cover;`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit)\nCSS property in order to scale and middle-crop it:\n\n\u003cimg src=\"https://docs.frameright.io/img/ekroos/skater_middlecrop.png\" align=\"right\"\u003e\n\n```html\n\u003cimg\n  src=\"https://react.frameright.io/assets/pics/skater.jpg\"\n  width=\"200\"\n  height=\"200\"\n  style=\"object-fit: cover;\"\n/\u003e\n```\n\nThis is less than optimal, as there might be, in the example above, a better\nsquare-ish region in the image that could be displayed instead of the\nmiddle-crop.\n\n### Basic usage\n\nThis React component extends its `\u003cimg\u003e`-like children with the ability to\nretrieve image regions from their image metadata, and to zoom in on the best one\nfor the current element size:\n\n\u003cimg src=\"https://docs.frameright.io/img/ekroos/skater_withidc.png\" align=\"right\"\u003e\n\n```html\n\u003cImageDisplayControl\u003e\n  \u003cimg\n    src=\"https://react.frameright.io/assets/pics/skater.jpg\"\n    width=\"200\"\n    height=\"200\"\n  /\u003e\n\u003c/ImageDisplayControl\u003e\n```\n\nThe resulting HTML element is responsive and will automatically reassess the\nbest region to zoom in on when it gets resized, e.g. when the user turns their\nphone from portrait to landscape.\n\n[![Youtube](https://img.youtube.com/vi/UsBtRSyY-7c/0.jpg)](https://www.youtube.com/watch?v=UsBtRSyY-7c \"Youtube\")\n\n\u0026emsp; :sparkles: [Live demo](https://react.frameright.io)\n\n\u0026emsp; 💻 [CodeSandbox](https://codesandbox.io/s/image-display-control-react-component-m6qj9r)\n\n\u0026emsp; :bulb: [GitHub Discussions](https://github.com/Frameright/react-image-display-control/discussions)\n\n## Image Display Control metadata\n\nNowadays an image file (e.g. JPEG, PNG) can contain this type of image regions\nin their metadata according to\n[the IPTC standard](https://iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#image-region).\nThis React component uses\n[a  library](https://github.com/Frameright/image-display-control-metadata-parser)\nto let the back-end or front-end extract the regions from the image file. It\nthen passes them to the `\u003cimg\u003e` tag and turns it into\n[a web component](https://github.com/Frameright/image-display-control-web-component),\nwhich automatically and responsively zooms in on the best region.\n\nPhotographers, or anyone else, can use the\n[Frameright webapp](https://frameright.app/) to define and store image regions in\nthe metadata of their pictures.\n\n## Installation\n\nIn your Node.js-based project (e.g. using [Next.js](https://nextjs.org/) or\n[Vite](https://vitejs.dev/)) run:\n\n```bash\nnpm install @frameright/react-image-display-control\n```\n\n\u003e **Less than 5kB in your final client-side bundle.**\n\n\u0026emsp; :floppy_disk:\n[Importing in your project](https://docs.frameright.io/react/importing)\n\n## Usage\n\n```tsx\n// src/MyComponent.tsx\n\nimport { ImageDisplayControl } from \"@frameright/react-image-display-control\";\n\nexport default function MyComponent() {\n  return (\n    \u003cImageDisplayControl\u003e\n      \u003cimg\n        src=\"https://react.frameright.io/assets/pics/skater.jpg\"\n        width=\"200\"\n        height=\"200\"\n      /\u003e\n    \u003c/ImageDisplayControl\u003e\n  );\n}\n```\n\nThis doesn't change the structure of the resulting DOM, i.e.:\n* the `\u003cimg\u003e` tag remains an `\u003cimg\u003e` tag, and\n* no new parent elements are added around it, so\n* the CSS rules that used to target the `\u003cimg\u003e` tag directly will still apply,\n  and\n* the `\u003cimg\u003e` tag will still naturally take the same space and position in the\n  layout.\n\nOther `\u003cimg\u003e`-like elements/components are supported as well, e.g.\n[Next.js `\u003cImage\u003e`s](https://nextjs.org/docs/api-reference/next/image) or\n[React-Bootstrap `\u003cImage\u003e`s](https://react-bootstrap.github.io/components/images/).\n\n\u0026emsp; :airplane:\n[Advanced usage](https://docs.frameright.io/react/usage)\n\n\u0026emsp; 🌍\n[Supported environments](https://docs.frameright.io/react/environments)\n\n\u0026emsp; :wrench: [Contributing](https://docs.frameright.io/react/contributing)\n\n\u0026emsp; 📝 [Changelog](https://docs.frameright.io/react/changelog)\n\n\u0026emsp; :sparkles: [Local demo](https://docs.frameright.io/react/example)\n\n\u0026emsp; :bulb: [GitHub Discussions](https://github.com/Frameright/react-image-display-control/discussions)\n\n\u0026emsp; :sparkles: [Live demo](https://react.frameright.io)\n\n\u0026emsp; 🙏\n[Dependency tree / credits](https://docs.frameright.io/react/credits)\n","funding_links":[],"categories":["UI Components"],"sub_categories":["Photo / Image"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrameright%2Freact-image-display-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrameright%2Freact-image-display-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrameright%2Freact-image-display-control/lists"}