{"id":20833147,"url":"https://github.com/miltonbhowmick/copy-paste-image-field","last_synced_at":"2026-04-29T05:34:35.330Z","repository":{"id":126907302,"uuid":"444676215","full_name":"Miltonbhowmick/copy-paste-image-field","owner":"Miltonbhowmick","description":"A javascript tricks to copy and paste image in text field","archived":false,"fork":false,"pushed_at":"2023-09-15T04:08:39.000Z","size":3213,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T14:10:59.404Z","etag":null,"topics":["copy-paste-image","javascript","javascript-copy-image","javascript-paste-image","javascript-tricks"],"latest_commit_sha":null,"homepage":"https://miltonbhowmick.github.io/copy-paste-image-field/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Miltonbhowmick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-01-05T05:31:25.000Z","updated_at":"2023-10-05T16:55:59.000Z","dependencies_parsed_at":"2025-01-18T21:11:45.234Z","dependency_job_id":null,"html_url":"https://github.com/Miltonbhowmick/copy-paste-image-field","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Miltonbhowmick/copy-paste-image-field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miltonbhowmick%2Fcopy-paste-image-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miltonbhowmick%2Fcopy-paste-image-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miltonbhowmick%2Fcopy-paste-image-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miltonbhowmick%2Fcopy-paste-image-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Miltonbhowmick","download_url":"https://codeload.github.com/Miltonbhowmick/copy-paste-image-field/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miltonbhowmick%2Fcopy-paste-image-field/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32412890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T05:20:56.964Z","status":"ssl_error","status_checked_at":"2026-04-29T05:19:54.749Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["copy-paste-image","javascript","javascript-copy-image","javascript-paste-image","javascript-tricks"],"created_at":"2024-11-18T00:14:24.089Z","updated_at":"2026-04-29T05:34:35.314Z","avatar_url":"https://github.com/Miltonbhowmick.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCOPY IMAGE - PASTE IMAGE \u003c/h1\u003e\n\u003cp align=\"center\"\u003eA mini tricks between \u003cb\u003einput field\u003c/b\u003e and \u003cb\u003eimg tag\u003c/b\u003e in html to show an image.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/Miltonbhowmick/copy-paste-image-field\"\u003e \n\u003c/p\u003e\n\n### Play it by yourself\n\u003ca href=\"https://miltonbhowmick.github.io/copy-paste-image-field/\"\u003eDemo\u003c/a\u003e\n\n### How it works\n\u003cimg src=\"images/demo.gif\" align=\"center\"\u003e\n\n\n### Which logic helps\n- Use `event.clipboardData` or `event.originalEvent.clipboardData`.\n- `event.clipboardData` or `event.originalEvent.clipboardData` contains items if they have. If they contain, write `var items = (event.clipboardData || event.originalEvent.clipboardData).items;`.\n- Now, you have `items`. Its `items`, you can do a loop 💁‍♂️. You can see each element by index of that loop `items[index]`.\n- We need only file item from `items[index]`. So, you may do a check like this `if (item.kind === 'file')`.\n- Get the blob data of this file item by writing `var blob = item.getAsFile();`.\n- As it is a file, you have to read the file item. To read a file item, Javascript has a class `FileReader()`. Write `var reader = new FileReader();`.\n- How can you see If a file is not loaded 🤫?. Write `reader.onload = function (event) {};`.\n- Inside the above `onload` function, you can write `document.getElementById(\"pastedImage\").src = event.target.result;` of your image html tag `\u003cimg id=\"pastedImage\"/\u003e`.\n- Then copy image and paste image and BOOM!!!. \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiltonbhowmick%2Fcopy-paste-image-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiltonbhowmick%2Fcopy-paste-image-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiltonbhowmick%2Fcopy-paste-image-field/lists"}