{"id":13450435,"url":"https://github.com/use-hooks/react-hooks-image-size","last_synced_at":"2025-12-30T03:38:03.278Z","repository":{"id":97005393,"uuid":"161428848","full_name":"use-hooks/react-hooks-image-size","owner":"use-hooks","description":"Custom React Hooks for image natural size","archived":false,"fork":false,"pushed_at":"2019-05-16T23:27:17.000Z","size":226,"stargazers_count":19,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T01:35:15.845Z","etag":null,"topics":["react","react-hooks"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/use-hooks.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}},"created_at":"2018-12-12T03:41:54.000Z","updated_at":"2022-03-05T10:03:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"39ab279e-5c06-4ad8-ad27-73e8a858b41e","html_url":"https://github.com/use-hooks/react-hooks-image-size","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"4b6a8b067a47b82c3716ae0ad16cbc6938198dcc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-hooks%2Freact-hooks-image-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-hooks%2Freact-hooks-image-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-hooks%2Freact-hooks-image-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-hooks%2Freact-hooks-image-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/use-hooks","download_url":"https://codeload.github.com/use-hooks/react-hooks-image-size/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221538992,"owners_count":16839778,"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":["react","react-hooks"],"created_at":"2024-07-31T07:00:34.609Z","updated_at":"2025-12-30T03:38:03.218Z","avatar_url":"https://github.com/use-hooks.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# react-hooks-image-size\n\n[![NPM version][npm-image]][npm-url]\n[![npm download][download-image]][download-url]\n[![Build Status][travis-image]][travis-url]\n\nCustom React Hooks for image natural size.\n\n## Install\n\n\u003e**Note:** Make sure that you have installed the correct version of `react(\u003e= v16.8.0)` and `react-dom(\u003e= v16.8.0)`.\n\n### npm\n\n```bash\nnpm install --save @use-hooks/image-size\n```\n\n### yarn\n\n```bash\nyarn add @use-hooks/image-size\n```\n\n## API\n\n### Params\n\n```js\n/**\n * Params\n * @param {string} url - The image url\n */\n```\n\n### Returns\n\n```js\n/**\n * Returns\n * @param {array} size - The image size [width, height]\n */\n```\n\n## Usage\n\n```js\nimport React from 'react';\n\nimport useImageSize from '@use-hooks/image-size';\n\nexport default function App() {\n  const url = 'https://cdn.int64ago.org/ogk39i54.png';\n  const [width, height] = useImageSize(url);\n\n  return (\n    \u003cdiv\u003e\n      \u003ch2\u003eDEMO of \u003cspan style={{ color: '#F44336' }}\u003e@use-hooks/image-size\u003c/span\u003e\u003c/h2\u003e\n      \u003cdiv\u003e\n        \u003cimg src={url} width={100} height={100} alt=\"\" /\u003e\n        \u003cdiv\u003eNatural size: {width} x {height}\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  );\n}\n\n```\n\n[Live Show](https://use-hooks.github.io/react-hooks-image-size/)\n\n## Development\n\n\u003e Node \u003e= v8 LTS\n\n - Clone the project to local disk\n - `npm install`\n - `npm start`\n\n## License\n\nMIT\n\n\u003e Generated by [create-react-hooks](https://github.com/use-hooks/create-react-hooks).\n\n [npm-image]: https://img.shields.io/npm/v/@use-hooks/image-size.svg?style=flat-square\n [npm-url]: https://npmjs.org/package/@use-hooks/image-size\n [download-image]: https://img.shields.io/npm/dm/@use-hooks/image-size.svg?style=flat-square\n [download-url]: https://npmjs.org/package/@use-hooks/image-size\n [travis-url]: https://travis-ci.com/use-hooks/react-hooks-image-size\n [travis-image]: https://img.shields.io/travis/com/use-hooks/react-hooks-image-size.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-hooks%2Freact-hooks-image-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuse-hooks%2Freact-hooks-image-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-hooks%2Freact-hooks-image-size/lists"}